3 Copyright 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
7 <!-- This file has tests to make sure Non-SFI NaCl loads and starts
8 up. libc_free.c is shared with irt_test.html where more IRT tests are
11 <title>NaCl Load Test
</title>
14 <h2>NaCl Load Test
</h2>
16 <script type=
"text/javascript" src=
"nacltest.js"> </script>
19 function report(msg
) {
20 domAutomationController
.setAutomationId(0);
21 // The automation controller seems to choke on Objects, so turn them into
23 domAutomationController
.send(JSON
.stringify(msg
));
26 function create(manifest_url
) {
27 var embed
= document
.createElement("embed");
28 embed
.src
= manifest_url
;
29 embed
.type
= "application/x-nacl";
31 embed
.addEventListener("error", function(evt
) {
32 report({type
: "Log", message
: "Load error: " + embed
.lastError
});
33 report({type
: "Shutdown", message
: "1 test failed.", passed
: false});
36 embed
.addEventListener("load", function(evt
) {
37 report({type
: "Log", message
: "Load is completed."});
38 // The loading is successfully done, so send a message to plugin.
39 // The message should be relayed back to the Javascript code.
40 embed
.postMessage("Message from Javascript to NaCl");
43 embed
.addEventListener("message", function(message
) {
44 if (message
.data
!= "Message from Javascript to NaCl") {
45 report({type
: "Log", message
: "Post Message error: " + message
.data
});
46 report({type
: "Shutdown", message
: "1 test failed.", passed
: false});
50 // Message is sent back. So, the test passes.
51 report({type
: "Shutdown", message
: "1 test passed.", passed
: true});
54 document
.body
.appendChild(embed
);
57 create("libc_free.nmf");