Revert "Only store leading 13 bits of password hash."
[chromium-blink-merge.git] / chrome / test / data / nacl / bad / ppapi_bad.js
blob8114cf8abeb283a6cf65546af6c4b75afb472404
1 // Copyright 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.
5 // Helper routines for generating bad load tests.
6 // Webpage must have an 'embeds' div for injecting NaCl modules.
7 // Depends on nacltest.js.
9 function createModule(id, src, type) {
10 return createNaClEmbed({
11 id: id,
12 src: src,
13 width: 100,
14 height: 20,
15 type: type
16 });
20 function addModule(module) {
21 $('embeds').appendChild(module);
25 function removeModule(module) {
26 $('embeds').removeChild(module);
30 function badLoadTest(tester, id, src, type, error_string) {
31 tester.addAsyncTest(id, function(test){
32 var module = createModule(id, src, type);
34 test.expectEvent(module, 'load', function(e) {
35 removeModule(module);
36 test.fail('Module loaded successfully.');
37 });
38 test.expectEvent(module, 'error', function(e) {
39 test.assertEqual(module.readyState, 4);
40 if (error_string instanceof RegExp)
41 test.assertRegexMatches(module.lastError, error_string);
42 else
43 test.assertEqual(module.lastError, error_string);
44 test.expectEvent(module, 'loadend', function(e) {
45 removeModule(module);
46 test.pass();
47 });
48 });
49 addModule(module);
50 });