Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: trunk/src/ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.js

Issue 15709012: Revert 205329 "Split pnacl and nacl mime types" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Helper routines for generating bad load tests. 1 // Helper routines for generating bad load tests.
6 // Webpage must have an 'embeds' div for injecting NaCl modules. 2 // Webpage must have an 'embeds' div for injecting NaCl modules.
7 // Depends on nacltest.js. 3 // Depends on nacltest.js.
8 4
9 function createModule(id, src, type) { 5 function createModule(id, src) {
10 return createNaClEmbed({ 6 return createNaClEmbed({
11 id: id, 7 id: id,
12 src: src, 8 src: src,
13 width: 100, 9 width: 100,
14 height: 20, 10 height: 20
15 type: type
16 }); 11 });
17 } 12 }
18 13
19 14
20 function addModule(module) { 15 function addModule(module) {
21 $('embeds').appendChild(module); 16 $('embeds').appendChild(module);
22 } 17 }
23 18
24 19
25 function removeModule(module) { 20 function removeModule(module) {
26 $('embeds').removeChild(module); 21 $('embeds').removeChild(module);
27 } 22 }
28 23
29 24
30 function badLoadTest(tester, id, src, type, error_string) { 25 function badLoadTest(tester, id, src, error_string) {
31 tester.addAsyncTest(id, function(test){ 26 tester.addAsyncTest(id, function(test){
32 var module = createModule(id, src, type); 27 var module = createModule(id, src);
33 28
34 test.expectEvent(module, 'load', function(e) { 29 test.expectEvent(module, 'load', function(e) {
35 removeModule(module); 30 removeModule(module);
36 test.fail('Module loaded successfully.'); 31 test.fail('Module loaded successfully.');
37 }); 32 });
38 test.expectEvent(module, 'error', function(e) { 33 test.expectEvent(module, 'error', function(e) {
39 test.assertEqual(module.readyState, 4); 34 test.assertEqual(module.readyState, 4);
40 test.assertEqual(module.lastError, error_string); 35 test.assertEqual(module.lastError, error_string);
41 test.expectEvent(module, 'loadend', function(e) { 36 test.expectEvent(module, 'loadend', function(e) {
42 removeModule(module); 37 removeModule(module);
43 test.pass(); 38 test.pass();
44 }); 39 });
45 }); 40 });
46 addModule(module); 41 addModule(module);
47 }); 42 });
48 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698