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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.js
===================================================================
--- ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.js (revision 0)
+++ ppapi/native_client/tests/ppapi_browser/bad/ppapi_bad.js (revision 0)
@@ -0,0 +1,43 @@
+// Helper routines for generating bad load tests.
+// Webpage must have an 'embeds' div for injecting NaCl modules.
+// Depends on nacltest.js.
+
+function createModule(id, src) {
+ return createNaClEmbed({
+ id: id,
+ src: src,
+ width: 100,
+ height: 20
+ });
+}
+
+
+function addModule(module) {
+ $('embeds').appendChild(module);
+}
+
+
+function removeModule(module) {
+ $('embeds').removeChild(module);
+}
+
+
+function badLoadTest(tester, id, src, error_string) {
+ tester.addAsyncTest(id, function(test){
+ var module = createModule(id, src);
+
+ test.expectEvent(module, 'load', function(e) {
+ removeModule(module);
+ test.fail('Module loaded successfully.');
+ });
+ test.expectEvent(module, 'error', function(e) {
+ test.assertEqual(module.readyState, 4);
+ test.assertEqual(module.lastError, error_string);
+ test.expectEvent(module, 'loadend', function(e) {
+ removeModule(module);
+ test.pass();
+ });
+ });
+ addModule(module);
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698