Home | History | Annotate | Download | only in crash
      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 
     14     <embed type="application/x-nacl" id="crash_via_check_failure"
     15            name="nacl_module"
     16            src="ppapi_crash_via_check_failure.nmf"
     17            width="0" height="0" />
     18     <embed type="application/x-nacl" id="crash_via_exit_call"
     19            name="nacl_module"
     20            src="ppapi_crash_via_exit_call.nmf"
     21            width="0" height="0" />
     22     <embed type="application/x-nacl" id="crash_in_callback"
     23            name="nacl_module"
     24            src="ppapi_crash_in_callback.nmf"
     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" />
     34 
     35     <script type="text/javascript">
     36       //<![CDATA[
     37       var tester = new Tester();
     38       function AddTest(plugin, testName, expectedEvent, unexpectedEvent,
     39                        pingToDetectCrash) {
     40         tester.addAsyncTest(testName, function(test) {
     41           test.expectEvent(plugin, expectedEvent,
     42                            function(e) { test.pass(); });
     43           test.expectEvent(plugin, unexpectedEvent,
     44                            function(e) { test.fail(); });
     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 dead. 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           }
     57         });
     58         tester.waitFor(plugin);
     59       }
     60 
     61       AddTest($('crash_via_check_failure'),
     62               'CrashViaCheckFailure', 'crash', 'error');
     63       AddTest($('crash_via_exit_call'),
     64               'CrashViaExitCall', '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);
     71 
     72       tester.run();
     73       //]]>
     74     </script>
     75   </body>
     76 </html>
     77