1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Set up listeners and test expectations for tests which use simple.cc
6 // This depends on load_util.js for reporting.
8 addTestListeners: function(embed
) {
9 embed
.addEventListener("load", function(evt
) {
10 embed
.postMessage("ping");
13 embed
.addEventListener("message", function(message
) {
14 var expected_message
= "pong";
15 if (message
.data
=== expected_message
) {
16 load_util
.report({type
: "Shutdown",
17 message
: "1 test passed.", passed
: true});
21 message
: "Error: expected reply (" + expected_message
+
22 "), actual reply (" + message
+ ")"});
23 load_util
.report({type
: "Shutdown",
24 message
: "1 test failed.", passed
: false});
28 embed
.addEventListener("error", function(evt
) {
29 load_util
.report({type
: "Log",
30 message
: "Load error: " + embed
.lastError
});
31 load_util
.report({type
: "Shutdown",
32 message
: "1 test failed.", passed
: false});
35 embed
.addEventListener("crash", function(evt
) {
36 load_util
.report({type
: "Log",
37 message
: "Crashed with status: " + embed
.exitStatus
});
38 load_util
.report({type
: "Shutdown",
39 message
: "1 test failed.", passed
: false});