Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / nacl / bad / ppapi_bad.html
blobe052e55f1b1cd09ddce172fe19126147981b50d2
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 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.
91 badLoadTest(
92 tester,
93 'bad_manifest_uses_nexes',
94 'ppapi_bad_manifest_uses_nexes.nmf',
95 mime_type,
96 'NaCl module load failed: manifest: missing \'program\' section.');
98 // 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
99 badLoadTest(
100 tester,
101 'bad_manifest_bad_files',
102 'ppapi_bad_manifest_bad_files.nmf',
103 mime_type,
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
110 badLoadTest(
111 tester,
112 'bad_manifest_nexe_arch',
113 'ppapi_bad_manifest_nexe_arch.nmf',
114 mime_type,
115 is_pnacl
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
125 badLoadTest(
126 tester,
127 'bad_ppp_initialize',
128 'ppapi_bad_ppp_initialize.nmf',
129 mime_type,
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
134 badLoadTest(
135 tester,
136 'bad_ppp_initialize_crash',
137 'ppapi_bad_ppp_initialize_crash.nmf',
138 mime_type,
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
143 badLoadTest(
144 tester,
145 'bad_no_ppp_instance',
146 'ppapi_bad_no_ppp_instance.nmf',
147 mime_type,
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
152 badLoadTest(
153 tester,
154 'bad_get_ppp_instance_crash',
155 'ppapi_bad_get_ppp_instance_crash.nmf',
156 mime_type,
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
161 badLoadTest(
162 tester,
163 'bad_ppp_instance_didcreate',
164 'ppapi_bad_ppp_instance_didcreate.nmf',
165 mime_type,
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.
170 badLoadTest(
171 tester,
172 'bad_ppp_instance_didcreate_crash',
173 'ppapi_bad_ppp_instance_didcreate_crash.nmf',
174 mime_type,
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.
182 badLoadTest(
183 tester,
184 'bad_event_replay_crash',
185 'ppapi_bad_event_replay_crash.nmf',
186 mime_type,
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);
197 tester.run();
199 //]]>
200 </script>
202 <!-- The tests will create and remove embeds from this div. -->
203 <div id="embeds"></div>
205 <script type="text/javascript">
206 //<![CDATA[
207 runTests();
208 //]]>
209 </script>
210 </body>
211 </html>