Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / nacl / bad / ppapi_bad.html
blob72b40acac93c205a557cba919c2b1686f89c5bb9
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 <!--
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.
8 -->
9 <head>
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; }
17 </style>
18 </head>
19 <body id="body">
20 <script type="text/javascript">
21 //<![CDATA[
23 var prefix = 'NaCl module load failed: ';
25 // PNaCl may have slightly different error messages (pexe instead of nexe).
26 function couldNotAccessNexe(is_pnacl) {
27 if (!is_pnacl) {
28 return prefix + 'access to nexe url was denied.';
29 } else {
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) {
36 if (!is_pnacl) {
37 return prefix + 'could not load nexe url.';
38 } else {
39 /* PP_ERROR_FAILED */
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";
47 if (is_pnacl) {
48 mime_type = "application/x-pnacl";
51 // 'bad_magic' loads a manifest, then loads a nexe that tests as invalid.
52 badLoadTest(
53 tester,
54 'bad_magic',
55 'ppapi_bad_magic.nmf',
56 mime_type,
57 is_pnacl
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.
66 badLoadTest(
67 tester,
68 'nonexistent_nexe',
69 'ppapi_bad_doesnotexist.nmf',
70 mime_type,
71 couldNotLoadNexe(is_pnacl));
73 // 'nonexistent_manifest' tries to load a nonexistent manifest.
74 badLoadTest(
75 tester,
76 'nonexistent_manifest',
77 'doesnotexist.manifest',
78 mime_type,
79 'NaCl module load failed: could not load manifest url.');
81 // 'bad_manifest' loads an invalid manifest.
82 badLoadTest(
83 tester,
84 'bad_manifest',
85 'ppapi_bad.html',
86 mime_type,
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.
90 badLoadTest(
91 tester,
92 'bad_manifest_uses_nexes',
93 'ppapi_bad_manifest_uses_nexes.nmf',
94 mime_type,
95 'NaCl module load failed: manifest: missing \'program\' section.');
97 // 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
98 badLoadTest(
99 tester,
100 'bad_manifest_bad_files',
101 'ppapi_bad_manifest_bad_files.nmf',
102 mime_type,
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
109 badLoadTest(
110 tester,
111 'bad_manifest_nexe_arch',
112 'ppapi_bad_manifest_nexe_arch.nmf',
113 mime_type,
114 is_pnacl
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
124 badLoadTest(
125 tester,
126 'bad_ppp_initialize',
127 'ppapi_bad_ppp_initialize.nmf',
128 mime_type,
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
133 badLoadTest(
134 tester,
135 'bad_ppp_initialize_crash',
136 'ppapi_bad_ppp_initialize_crash.nmf',
137 mime_type,
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
142 badLoadTest(
143 tester,
144 'bad_no_ppp_instance',
145 'ppapi_bad_no_ppp_instance.nmf',
146 mime_type,
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
151 badLoadTest(
152 tester,
153 'bad_get_ppp_instance_crash',
154 'ppapi_bad_get_ppp_instance_crash.nmf',
155 mime_type,
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
160 badLoadTest(
161 tester,
162 'bad_ppp_instance_didcreate',
163 'ppapi_bad_ppp_instance_didcreate.nmf',
164 mime_type,
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.
169 badLoadTest(
170 tester,
171 'bad_ppp_instance_didcreate_crash',
172 'ppapi_bad_ppp_instance_didcreate_crash.nmf',
173 mime_type,
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.
181 badLoadTest(
182 tester,
183 'bad_event_replay_crash',
184 'ppapi_bad_event_replay_crash.nmf',
185 mime_type,
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);
196 tester.run();
198 //]]>
199 </script>
201 <!-- The tests will create and remove embeds from this div. -->
202 <div id="embeds"></div>
204 <script type="text/javascript">
205 //<![CDATA[
206 runTests();
207 //]]>
208 </script>
209 </body>
210 </html>