OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <head> | 7 <head> |
8 <title>NaCl Load Test</title> | 8 <title>PNaCl Debug URL test</title> |
9 <script type="text/javascript" src="nacltest.js"></script> | 9 <script type="text/javascript" src="nacltest.js"></script> |
10 </head> | 10 </head> |
11 <body> | 11 <body> |
12 <h2>PNaCl Load Options Test</h2> | 12 <h2>PNaCl Debug URL Test</h2> |
13 </body> | 13 </body> |
14 <script> | 14 <script> |
15 | 15 |
16 function report(msg) { | 16 function report(msg) { |
17 domAutomationController.setAutomationId(0); | 17 domAutomationController.setAutomationId(0); |
18 // The automation controller seems to choke on Objects, so turn them into | 18 // The automation controller seems to choke on Objects, so turn them into |
19 // strings. | 19 // strings. |
20 domAutomationController.send(JSON.stringify(msg)); | 20 domAutomationController.send(JSON.stringify(msg)); |
21 } | 21 } |
22 | 22 |
23 function create(manifest_prefix, manifest_opt) { | 23 var tests_passed = 0; |
24 var expected_tests = 2; | |
25 | |
26 function create(nmf_url) { | |
24 var embed = document.createElement("embed"); | 27 var embed = document.createElement("embed"); |
25 var nmf_url = manifest_prefix + manifest_opt + ".nmf"; | |
26 | 28 |
27 embed.src = nmf_url; | 29 embed.src = nmf_url; |
28 embed.type = "application/x-pnacl"; | 30 embed.type = "application/x-pnacl"; |
29 | 31 |
30 embed.addEventListener("load", function(evt) { | 32 embed.addEventListener("load", function(evt) { |
31 report({type: "Shutdown", message: "1 test passed.", passed: true}); | 33 tests_passed++; |
34 if (tests_passed == expected_tests) { | |
35 report({type: "Shutdown", | |
36 message: expected_tests + " test passed.", | |
37 passed: true}); | |
38 } | |
32 }, true); | 39 }, true); |
33 | 40 |
34 embed.addEventListener("error", function(evt) { | 41 embed.addEventListener("error", function(evt) { |
35 report({type: "Log", message: "Load error: " + embed.lastError}); | 42 report({type: "Log", message: "Load error: " + embed.lastError}); |
36 report({type: "Shutdown", message: "1 test failed.", passed: false}); | 43 report({type: "Shutdown", message: "1 test failed.", passed: false}); |
37 }, true); | 44 }, true); |
38 | 45 |
39 document.body.appendChild(embed); | 46 document.body.appendChild(embed); |
40 } | 47 } |
41 | 48 |
42 var nmf_to_test = getTestArguments( | 49 // Load an NMF w/ a special debug url. It should pick that and work. |
43 {'use_nmf' : 'Unknown NMF choice'})['use_nmf']; | 50 // Load an NMF w/ no special debug url. It should fall back to the |
51 // non-debug one and succeed. | |
bradn
2014/02/27 00:14:42
So it seems like this should do the debug url if d
jvoung (off chromium)
2014/02/27 23:06:37
Added a test where the manifest has both choices,
| |
52 create("pnacl_has_debug.nmf"); | |
53 create("pnacl_no_debug.nmf"); | |
44 | 54 |
45 create("pnacl_", nmf_to_test); | |
46 </script> | 55 </script> |
47 </html> | 56 </html> |
OLD | NEW |