| <html> |
| <!-- |
| Copyright 2014 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| <!-- This file has tests to make sure Non-SFI NaCl loads and starts |
| up. libc_free.c is shared with irt_test.html where more IRT tests are |
| done. --> |
| <head> |
| <title>NaCl Load Test</title> |
| </head> |
| <body> |
| <h2>NaCl Load Test</h2> |
| </body> |
| <script type="text/javascript" src="nacltest.js"> </script> |
| <script> |
| |
| function report(msg) { |
| // The automation controller seems to choke on Objects, so turn them into |
| // strings. |
| domAutomationController.send(JSON.stringify(msg)); |
| } |
| |
| function create(manifest_url) { |
| var embed = document.createElement("embed"); |
| embed.src = manifest_url; |
| embed.type = "application/x-nacl"; |
| |
| embed.addEventListener("error", function(evt) { |
| report({type: "Log", message: "Load error: " + embed.lastError}); |
| report({type: "Shutdown", message: "1 test failed.", passed: false}); |
| }, true); |
| |
| embed.addEventListener("load", function(evt) { |
| report({type: "Log", message: "Load is completed."}); |
| // The loading is successfully done, so send a message to plugin. |
| // The message should be relayed back to the Javascript code. |
| embed.postMessage("Message from Javascript to NaCl"); |
| }, true); |
| |
| embed.addEventListener("message", function(message) { |
| if (message.data != "Message from Javascript to NaCl") { |
| report({type: "Log", message: "Post Message error: " + message.data}); |
| report({type: "Shutdown", message: "1 test failed.", passed: false}); |
| return; |
| } |
| |
| // Message is sent back. So, the test passes. |
| report({type: "Shutdown", message: "1 test passed.", passed: true}); |
| }, true); |
| |
| document.body.appendChild(embed); |
| } |
| |
| create("libc_free.nmf"); |
| </script> |
| </html> |