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 new RegExp('NaCl module load failed: manifest JSON parsing failed: ' +
88 'Line: 1, column: 1.*'));
90 // 'bad_manifest_uses_nexes' loads a manifest with an obsolete 'nexes' section.
93 'bad_manifest_uses_nexes',
94 'ppapi_bad_manifest_uses_nexes.nmf',
96 'NaCl module load failed: manifest: missing \'program\' section.');
98 // 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
101 'bad_manifest_bad_files',
102 'ppapi_bad_manifest_bad_files.nmf',
104 // Manifest loader expects either 'url' or 'pnacl-translate' key present.
105 // If neither is found, it complains about the last one.
106 'NaCl module load failed: manifest: file.txt property \'unknown_arch\' does not have required key: \'url\'.');
108 // 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
109 // user's architecture
112 'bad_manifest_nexe_arch',
113 'ppapi_bad_manifest_nexe_arch.nmf',
116 ? 'NaCl module load failed: manifest: no version of program given for portable.'
117 : 'NaCl module load failed: manifest: no version of program given for current arch and no portable version found.');
119 //////////////////////////////////////
120 // Initialization errors begin here //
121 //////////////////////////////////////
123 // 'bad_ppp_initialize' loads a manifest, then loads a nexe that fails to
124 // initialize PPAPI module
127 'bad_ppp_initialize',
128 'ppapi_bad_ppp_initialize.nmf',
130 'NaCl module load failed: Nexe crashed during startup');
132 // 'bad_ppp_initialize_crash' loads a manifest, then loads a nexe that crashes
133 // before initializing PPAPI module
136 'bad_ppp_initialize_crash',
137 'ppapi_bad_ppp_initialize_crash.nmf',
139 'NaCl module load failed: Nexe crashed during startup');
141 // 'bad_no_ppp_instance' loads a manifest, then loads a nexe that fails to
142 // get the required PPP_Instance interface
145 'bad_no_ppp_instance',
146 'ppapi_bad_no_ppp_instance.nmf',
148 'NaCl module load failed: could not initialize module.');
150 // 'bad_get_ppp_instance_crash' loads a manifest, then loads a nexe that
151 // crashes when getting the required PPP_Instance interface
154 'bad_get_ppp_instance_crash',
155 'ppapi_bad_get_ppp_instance_crash.nmf',
157 'NaCl module load failed: could not initialize module.');
159 // 'bad_ppp_instance_didcreate' loads a manifest, then loads a nexe that fails
160 // to create the instance
163 'bad_ppp_instance_didcreate',
164 'ppapi_bad_ppp_instance_didcreate.nmf',
166 'NaCl module load failed: could not create instance.');
168 // 'bad_ppp_instance_didcreate_crash' loads a manifest, then loads a nexe that
169 // crashes before creating the instance.
172 'bad_ppp_instance_didcreate_crash',
173 'ppapi_bad_ppp_instance_didcreate_crash.nmf',
175 'NaCl module load failed: could not create instance.');
177 /* TODO(bbudge) Re-enable this test when the IPC proxy can report these errors.
178 http://crbug.com/160076
179 // 'bad_event_replay_crash' loads a manifest, then loads a nexe and replays
180 // the events that occured during loading causing the nexe to crash before
181 // proxy start-up was completed.
184 'bad_event_replay_crash',
185 'ppapi_bad_event_replay_crash.nmf',
187 'NaCl module load failed: instance crashed after creation.');
192 // The driver invoked when the body has finished loading.
193 function runTests() {
194 var tester
= new Tester($('body'));
195 tester
.loadErrorsAreOK();
196 declareTests(tester
);
202 <!-- The tests will create and remove embeds from this div. -->
203 <div id=
"embeds"></div>
205 <script type=
"text/javascript">