1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 Copyright 2013 The Chromium Authors. All rights reserved.
6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file.
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 <script type=
"text/javascript" src=
"ppapi_bad.js"> </script>
14 <title> PPAPI bad manifest/nexe URLs
</title>
15 <style type=
"text/css">
16 .naclModule { background-color: gray
; margin: 2px 2px; }
20 <script type=
"text/javascript">
23 var prefix
= 'NaCl module load failed: ';
25 // PNaCl may have slightly different error messages (pexe instead of nexe).
26 function couldNotAccessNexe(is_pnacl
) {
28 return prefix
+ 'access to nexe url was denied.';
30 return prefix
+ 'PnaclCoordinator: pexe load failed (no access).';
34 // PNaCl may have slightly different error messages (pexe instead of nexe).
35 function couldNotLoadNexe(is_pnacl
) {
37 return prefix
+ 'could not load nexe url.';
40 return prefix
+ 'PnaclCoordinator: pexe load failed (pp_error=-2).';
44 function declareTests(tester
) {
45 var is_pnacl
= getTestArguments()['pnacl'] !== undefined;
46 var mime_type
= "application/x-nacl";
48 mime_type
= "application/x-pnacl";
51 // 'bad_magic' loads a manifest, then loads a nexe that tests as invalid.
55 'ppapi_bad_magic.nmf',
58 // Use a regular expression here: the translator outputs debug
59 // information in the error message.
60 ? new RegExp('NaCl module load failed: PnaclCoordinator: ' +
61 'PNaCl Translator Error: .*' +
62 'Invalid PNaCl bitcode header')
63 : 'NaCl module load failed: Bad ELF header magic number');
65 // 'nonexistent_nexe' loads a manifest, then tries to load a nonexistent nexe.
69 'ppapi_bad_doesnotexist.nmf',
71 couldNotLoadNexe(is_pnacl
));
73 // 'nonexistent_manifest' tries to load a nonexistent manifest.
76 'nonexistent_manifest',
77 'doesnotexist.manifest',
79 'NaCl module load failed: could not load manifest url.');
81 // 'bad_manifest' loads an invalid manifest.
87 'NaCl module load failed: manifest JSON parsing failed: * Line 1, Column 1\n Syntax error: value, object or array expected.\n');
89 // 'bad_manifest_uses_nexes' loads a manifest with an obsolete 'nexes' section.
92 'bad_manifest_uses_nexes',
93 'ppapi_bad_manifest_uses_nexes.nmf',
95 'NaCl module load failed: manifest: missing \'program\' section.');
97 // 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
100 'bad_manifest_bad_files',
101 'ppapi_bad_manifest_bad_files.nmf',
103 // Manifest loader expects either 'url' or 'pnacl-translate' key present.
104 // If neither is found, it complains about the last one.
105 'NaCl module load failed: manifest: file.txt property \'unknown_arch\' does not have required key: \'url\'.');
107 // 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
108 // user's architecture
111 'bad_manifest_nexe_arch',
112 'ppapi_bad_manifest_nexe_arch.nmf',
115 ? 'NaCl module load failed: manifest: no version of program given for portable.'
116 : 'NaCl module load failed: manifest: no version of program given for current arch and no portable version found.');
118 //////////////////////////////////////
119 // Initialization errors begin here //
120 //////////////////////////////////////
122 // 'bad_ppp_initialize' loads a manifest, then loads a nexe that fails to
123 // initialize PPAPI module
126 'bad_ppp_initialize',
127 'ppapi_bad_ppp_initialize.nmf',
129 'NaCl module load failed: Nexe crashed during startup');
131 // 'bad_ppp_initialize_crash' loads a manifest, then loads a nexe that crashes
132 // before initializing PPAPI module
135 'bad_ppp_initialize_crash',
136 'ppapi_bad_ppp_initialize_crash.nmf',
138 'NaCl module load failed: Nexe crashed during startup');
140 // 'bad_no_ppp_instance' loads a manifest, then loads a nexe that fails to
141 // get the required PPP_Instance interface
144 'bad_no_ppp_instance',
145 'ppapi_bad_no_ppp_instance.nmf',
147 'NaCl module load failed: could not initialize module.');
149 // 'bad_get_ppp_instance_crash' loads a manifest, then loads a nexe that
150 // crashes when getting the required PPP_Instance interface
153 'bad_get_ppp_instance_crash',
154 'ppapi_bad_get_ppp_instance_crash.nmf',
156 'NaCl module load failed: could not initialize module.');
158 // 'bad_ppp_instance_didcreate' loads a manifest, then loads a nexe that fails
159 // to create the instance
162 'bad_ppp_instance_didcreate',
163 'ppapi_bad_ppp_instance_didcreate.nmf',
165 'NaCl module load failed: could not create instance.');
167 // 'bad_ppp_instance_didcreate_crash' loads a manifest, then loads a nexe that
168 // crashes before creating the instance.
171 'bad_ppp_instance_didcreate_crash',
172 'ppapi_bad_ppp_instance_didcreate_crash.nmf',
174 'NaCl module load failed: could not create instance.');
176 /* TODO(bbudge) Re-enable this test when the IPC proxy can report these errors.
177 http://crbug.com/160076
178 // 'bad_event_replay_crash' loads a manifest, then loads a nexe and replays
179 // the events that occured during loading causing the nexe to crash before
180 // proxy start-up was completed.
183 'bad_event_replay_crash',
184 'ppapi_bad_event_replay_crash.nmf',
186 'NaCl module load failed: instance crashed after creation.');
191 // The driver invoked when the body has finished loading.
192 function runTests() {
193 var tester
= new Tester($('body'));
194 tester
.loadErrorsAreOK();
195 declareTests(tester
);
201 <!-- The tests will create and remove embeds from this div. -->
202 <div id=
"embeds"></div>
204 <script type=
"text/javascript">