OLD | NEW |
---|---|
1 // Helper routines for generating bad load tests. | 1 // Helper routines for generating bad load tests. |
2 // Webpage must have an 'embeds' div for injecting NaCl modules. | 2 // Webpage must have an 'embeds' div for injecting NaCl modules. |
3 // Depends on nacltest.js. | 3 // Depends on nacltest.js. |
4 | 4 |
5 function createModule(id, src) { | 5 function createModule(id, src, type) { |
6 return createNaClEmbed({ | 6 return createNaClEmbed({ |
7 id: id, | 7 id: id, |
8 src: src, | 8 src: src, |
9 width: 100, | 9 width: 100, |
10 height: 20 | 10 height: 20, |
11 type: type | |
11 }); | 12 }); |
12 } | 13 } |
13 | 14 |
14 | 15 |
15 function addModule(module) { | 16 function addModule(module) { |
16 $('embeds').appendChild(module); | 17 $('embeds').appendChild(module); |
17 } | 18 } |
18 | 19 |
19 | 20 |
20 function removeModule(module) { | 21 function removeModule(module) { |
21 $('embeds').removeChild(module); | 22 $('embeds').removeChild(module); |
22 } | 23 } |
23 | 24 |
24 | 25 |
25 function badLoadTest(tester, id, src, error_string) { | 26 function badLoadTest(tester, id, src, type, error_string) { |
jvoung (off chromium)
2013/06/04 22:27:25
Can you look for other uses of badLoadTest under t
sehr
2013/06/06 22:03:45
Done. Sorry I missed these.
| |
26 tester.addAsyncTest(id, function(test){ | 27 tester.addAsyncTest(id, function(test){ |
27 var module = createModule(id, src); | 28 var module = createModule(id, src, type); |
28 | 29 |
29 test.expectEvent(module, 'load', function(e) { | 30 test.expectEvent(module, 'load', function(e) { |
30 removeModule(module); | 31 removeModule(module); |
31 test.fail('Module loaded successfully.'); | 32 test.fail('Module loaded successfully.'); |
32 }); | 33 }); |
33 test.expectEvent(module, 'error', function(e) { | 34 test.expectEvent(module, 'error', function(e) { |
34 test.assertEqual(module.readyState, 4); | 35 test.assertEqual(module.readyState, 4); |
35 test.assertEqual(module.lastError, error_string); | 36 test.assertEqual(module.lastError, error_string); |
36 test.expectEvent(module, 'loadend', function(e) { | 37 test.expectEvent(module, 'loadend', function(e) { |
37 removeModule(module); | 38 removeModule(module); |
38 test.pass(); | 39 test.pass(); |
39 }); | 40 }); |
40 }); | 41 }); |
41 addModule(module); | 42 addModule(module); |
42 }); | 43 }); |
43 } | 44 } |
OLD | NEW |