1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 Copyright (c) 2012 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 test_args = getTestArguments({'is_pnacl': '0'});
46 var is_pnacl = parseInt(test_args['is_pnacl']);
47 var mime_type = "application/x-nacl";
49 mime_type = "application/x-pnacl";
52 // 'bad_magic' loads a manifest, then loads a nexe that tests as invalid.
56 'ppapi_bad_magic.nmf',
58 'NaCl module load failed: Bad ELF header magic number');
60 // 'cross_origin' loads a manifest, then tries to load a cross-origin nexe.
64 'ppapi_bad_crossorigin.nmf',
66 couldNotAccessNexe(is_pnacl));
68 // 'cross_manifest' tries to load a cross-origin manifest.
72 'http://www.google.com/crossorigin.manifest',
74 'NaCl module load failed: access to manifest url was denied.');
76 // 'nonexistent_nexe' loads a manifest, then tries to load a nonexistent nexe.
80 'ppapi_bad_doesnotexist.nmf',
82 couldNotLoadNexe(is_pnacl));
84 // 'nonexistent_manifest' tries to load a nonexistent manifest.
87 'nonexistent_manifest',
88 'doesnotexist.manifest',
90 'NaCl module load failed: could not load manifest url.');
92 // 'bad_manifest' loads an invalid manifest.
98 'NaCl module load failed: manifest JSON parsing failed: * Line 1, Column 1\n Syntax error: value, object or array expected.\n');
100 // 'bad_manifest_uses_nexes' loads a manifest with an obsolete 'nexes' section.
103 'bad_manifest_uses_nexes',
104 'ppapi_bad_manifest_uses_nexes.nmf',
106 'NaCl module load failed: manifest: missing \'program\' section.');
108 // 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
111 'bad_manifest_bad_files',
112 'ppapi_bad_manifest_bad_files.nmf',
114 // Manifest loader expects either 'url' or 'pnacl-translate' key present.
115 // If neither is found, it complains about the last one.
116 'NaCl module load failed: manifest: file.txt property \'unknown_arch\' does not have required key: \'url\'.');
118 // 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
119 // user's architecture
122 'bad_manifest_nexe_arch',
123 'ppapi_bad_manifest_nexe_arch.nmf',
125 'NaCl module load failed: manifest: no version of program given for current arch and no portable version found.');
127 //////////////////////////////////////
128 // Initialization errors begin here //
129 //////////////////////////////////////
131 // 'bad_ppp_initialize' loads a manifest, then loads a nexe that fails to
132 // initialize PPAPI module
135 'bad_ppp_initialize',
136 'ppapi_bad_ppp_initialize.nmf',
138 'NaCl module load failed: could not initialize module.');
140 // 'bad_ppp_initialize_crash' loads a manifest, then loads a nexe that crashes
141 // before initializing PPAPI module
144 'bad_ppp_initialize_crash',
145 'ppapi_bad_ppp_initialize_crash.nmf',
147 'NaCl module load failed: could not initialize module.');
149 // 'bad_no_ppp_instance' loads a manifest, then loads a nexe that fails to
150 // get the required PPP_Instance interface
153 'bad_no_ppp_instance',
154 'ppapi_bad_no_ppp_instance.nmf',
156 'NaCl module load failed: could not initialize module.');
158 // 'bad_get_ppp_instance_crash' loads a manifest, then loads a nexe that
159 // crashes when getting the required PPP_Instance interface
162 'bad_get_ppp_instance_crash',
163 'ppapi_bad_get_ppp_instance_crash.nmf',
165 'NaCl module load failed: could not initialize module.');
167 // 'bad_ppp_instance_didcreate' loads a manifest, then loads a nexe that fails
168 // to create the instance
171 'bad_ppp_instance_didcreate',
172 'ppapi_bad_ppp_instance_didcreate.nmf',
174 'NaCl module load failed: could not create instance.');
176 // 'bad_ppp_instance_didcreate_crash' loads a manifest, then loads a nexe that
177 // crashes before creating the instance.
180 'bad_ppp_instance_didcreate_crash',
181 'ppapi_bad_ppp_instance_didcreate_crash.nmf',
183 'NaCl module load failed: could not create instance.');
185 /* TODO(bbudge) Re-enable this test when the IPC proxy can report these errors.
186 http://crbug.com/160076
187 // 'bad_event_replay_crash' loads a manifest, then loads a nexe and replays
188 // the events that occured during loading causing the nexe to crash before
189 // proxy start-up was completed.
192 'bad_event_replay_crash',
193 'ppapi_bad_event_replay_crash.nmf',
195 'NaCl module load failed: instance crashed after creation.');
200 // The driver invoked when the body has finished loading.
201 function runTests() {
202 var tester = new Tester($('body'));
203 tester.loadErrorsAreOK();
204 declareTests(tester);
210 <!-- The tests will create and remove embeds from this div. -->
211 <div id="embeds"></div>
213 <!-- These two embeds are not automatically tested - visual inspection only. -->
215 <embed id="cross_manifest_pdf"
217 src="http://www.google.com/crossorigin.manifest"
218 style="background-color:gray"
219 type="application/pdf" />
221 <!-- This load would have succeeded if the NEXE was from a chrome-extension
222 URL and NaCl had been registered as handling the PDF MIME type using
223 the nacl_modules attribute in a Chrome extension manifest. -->
225 <embed id="cross_origin_pdf"
227 src="ppapi_bad_crossorigin.nmf"
228 style="background-color:gray"
229 type="application/pdf" />
231 <script type="text/javascript">