OLD | NEW |
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
3 <html> | 3 <html> |
4 <!-- Copyright (c) 2011 Google Inc. All rights reserved. --> | 4 <!-- Copyright (c) 2011 Google Inc. All rights reserved. --> |
5 <head> | 5 <head> |
6 <meta http-equiv="Pragma" content="no-cache" /> | 6 <meta http-equiv="Pragma" content="no-cache" /> |
7 <meta http-equiv="Expires" content="-1" /> | 7 <meta http-equiv="Expires" content="-1" /> |
8 <script type="text/javascript" src="nacltest.js"></script> | 8 <script type="text/javascript" src="nacltest.js"></script> |
9 <title>Nexe Crash Test</title> | 9 <title>Nexe Crash Test</title> |
10 </head> | 10 </head> |
11 <body> | 11 <body> |
12 <h1>Nexe Crash Test</h1> | 12 <h1>Nexe Crash Test</h1> |
13 | 13 |
14 <embed type="application/x-nacl" id="crash_via_check_failure" | 14 <embed type="application/x-nacl" id="crash_via_check_failure" |
15 name="nacl_module" | 15 name="nacl_module" |
16 src="ppapi_crash_via_check_failure.nmf" | 16 src="ppapi_crash_via_check_failure.nmf" |
17 width="0" height="0" /> | 17 width="0" height="0" /> |
18 <embed type="application/x-nacl" id="crash_via_exit_call" | 18 <embed type="application/x-nacl" id="crash_via_exit_call" |
19 name="nacl_module" | 19 name="nacl_module" |
20 src="ppapi_crash_via_exit_call.nmf" | 20 src="ppapi_crash_via_exit_call.nmf" |
21 width="0" height="0" /> | 21 width="0" height="0" /> |
22 <embed type="application/x-nacl" id="crash_in_callback" | 22 <embed type="application/x-nacl" id="crash_in_callback" |
23 name="nacl_module" | 23 name="nacl_module" |
24 src="ppapi_crash_in_callback.nmf" | 24 src="ppapi_crash_in_callback.nmf" |
25 width="0" height="0" /> | 25 width="0" height="0" /> |
| 26 <embed type="application/x-nacl" id="crash_ppapi_off_main_thread" |
| 27 name="nacl_module" |
| 28 src="ppapi_crash_ppapi_off_main_thread.nmf" |
| 29 width="0" height="0" /> |
| 30 <embed type="application/x-nacl" id="crash_off_main_thread" |
| 31 name="nacl_module" |
| 32 src="ppapi_crash_off_main_thread.nmf" |
| 33 width="0" height="0" /> |
26 | 34 |
27 <script type="text/javascript"> | 35 <script type="text/javascript"> |
28 //<![CDATA[ | 36 //<![CDATA[ |
29 var tester = new Tester(); | 37 var tester = new Tester(); |
30 function AddTest(plugin, testName, expectedHandler, unexpectedHandler) { | 38 function AddTest(plugin, testName, expectedEvent, unexpectedEvent, |
| 39 pingToDetectCrash) { |
31 tester.addAsyncTest(testName, function(test) { | 40 tester.addAsyncTest(testName, function(test) { |
32 plugin.addEventListener( | 41 test.expectEvent(plugin, expectedEvent, |
33 expectedHandler, | 42 function(e) { test.pass(); }); |
34 test.wrap(function(e) { test.pass(); }), | 43 test.expectEvent(plugin, unexpectedEvent, |
35 false); | 44 function(e) { test.fail(); }); |
36 plugin.addEventListener( | |
37 unexpectedHandler, | |
38 test.wrap(function(e) { test.fail(); }), | |
39 false); | |
40 plugin.postMessage(testName); | 45 plugin.postMessage(testName); |
| 46 // In case the nexe does not crash right away, we will ping it |
| 47 // until we detect that it's death. DidChangeView and other events |
| 48 // can do this too, but are less reliable. |
| 49 if (pingToDetectCrash) { |
| 50 function PingBack(message) { |
| 51 test.log(message.data); |
| 52 plugin.postMessage('Ping'); |
| 53 } |
| 54 plugin.addEventListener('message', PingBack, false); |
| 55 plugin.postMessage("Ping"); |
| 56 } |
41 }); | 57 }); |
42 tester.waitFor(plugin); | 58 tester.waitFor(plugin); |
43 } | 59 } |
44 | 60 |
45 AddTest($('crash_via_check_failure'), | 61 AddTest($('crash_via_check_failure'), |
46 'CrashViaCheckFailure', 'crash', 'error'); | 62 'CrashViaCheckFailure', 'crash', 'error'); |
47 AddTest($('crash_via_exit_call'), | 63 AddTest($('crash_via_exit_call'), |
48 'CrashViaExitCall', 'crash', 'error'); | 64 'CrashViaExitCall', 'crash', 'error'); |
49 AddTest($('crash_in_callback'), 'CrashInCallback', 'crash', 'error'); | 65 AddTest($('crash_in_callback'), |
| 66 'CrashInCallback', 'crash', 'error'); |
| 67 AddTest($('crash_ppapi_off_main_thread'), |
| 68 'CrashPPAPIOffMainThread', 'crash', 'error'); |
| 69 AddTest($('crash_off_main_thread'), |
| 70 'CrashOffMainThread', 'crash', 'error', true); |
50 | 71 |
51 tester.run(); | 72 tester.run(); |
52 //]]> | 73 //]]> |
53 </script> | 74 </script> |
54 </body> | 75 </body> |
55 </html> | 76 </html> |
OLD | NEW |