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

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

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
(Empty)
1 // Helper routines for generating bad load tests.
2 // Webpage must have an 'embeds' div for injecting NaCl modules.
3 // Depends on nacltest.js.
4
5 function createModule(id, src) {
6 return createNaClEmbed({
7 id: id,
8 src: src,
9 width: 100,
10 height: 20
11 });
12 }
13
14
15 function addModule(module) {
16 $('embeds').appendChild(module);
17 }
18
19
20 function removeModule(module) {
21 $('embeds').removeChild(module);
22 }
23
24
25 function badLoadTest(tester, id, src, error_string) {
26 tester.addAsyncTest(id, function(test){
27 var module = createModule(id, src);
28
29 test.expectEvent(module, 'load', function(e) {
30 removeModule(module);
31 test.fail('Module loaded successfully.');
32 });
33 test.expectEvent(module, 'error', function(e) {
34 test.assertEqual(module.readyState, 4);
35 test.assertEqual(module.lastError, error_string);
36 test.expectEvent(module, 'loadend', function(e) {
37 removeModule(module);
38 test.pass();
39 });
40 });
41 addModule(module);
42 });
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698