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