2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can
4 be found in the LICENSE file.
6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
7 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
10 <meta http-equiv="Pragma" content="no-cache" />
11 <meta http-equiv="Expires" content="-1" />
12 <script type="text/javascript" src="nacltest.js"></script>
13 <title>Native Client Exit Status Test</title>
17 <h1>Native Client Exit Status Test</h1>
19 <script type="text/javascript">
21 function createModule(id, src, type) {
22 return createNaClEmbed({
31 var mime = "application/x-nacl";
32 if (getTestArguments()["pnacl"] !== undefined) {
33 mime = "application/x-pnacl";
35 var embed = createModule("naclModule", "pm_exit_status_test.nmf", mime);
36 embed.basic_tests = "2";
37 embed.stress_tests = "0";
38 document.body.appendChild(embed);
40 var tester = new Tester($('body'));
41 var args = getTestArguments({'expected_exit' :
42 'THIS TEST CANNOT RUN STANDALONE -- run using scons instead'});
44 function setupTests(tester, plugin) {
45 tester.addAsyncTest('StartTest', function(status) {
46 plugin.addEventListener('message', status.wrap(function(message_event) {
47 this.removeEventListener('message', arguments.callee, false);
48 status.assertEqual(message_event.data,
52 plugin.postMessage('init');
54 tester.addAsyncTest('Exit0Test', function(status) {
55 plugin.addEventListener('crash', status.wrap(function(crash_event) {
56 this.removeEventListener('crash', arguments.callee, false);
57 status.assertEqual($('naclModule').exitStatus,
58 parseInt(args.expected_exit));
61 plugin.postMessage(args.trigger);
65 var tester = new Tester();
66 setupTests(tester, $('naclModule'));
67 tester.waitFor($('naclModule'));
69 // otherwise trivially passes