1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <!-- Copyright (c) 2011 Google Inc. All rights reserved. -->
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>
12 <h1>Nexe Crash Test
</h1>
13 <script type=
"text/javascript">
15 function createModule(id
, type
) {
16 return createNaClEmbed({
18 src
: 'ppapi_' + id
+ '.nmf',
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
,
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");
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);