dom/indexedDB/test/unit/test_globalObjects_other.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:82ca96987085
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
5
6 var testGenerator = testSteps();
7
8 function testSteps()
9 {
10 let ioService =
11 Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
12
13 function getSpec(filename) {
14 let file = do_get_file(filename);
15 let uri = ioService.newFileURI(file);
16 return uri.spec;
17 }
18
19 // Test for IDBKeyRange and indexedDB availability in JS modules.
20 Cu.import(getSpec("GlobalObjectsModule.jsm"));
21 let test = new GlobalObjectsModule();
22 test.ok = ok;
23 test.finishTest = continueToNextStep;
24 test.runTest();
25 yield undefined;
26
27 // Test for IDBKeyRange and indexedDB availability in JS components.
28 do_load_manifest("GlobalObjectsComponent.manifest");
29 test = Cc["@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1"].
30 createInstance(Ci.nsISupports).wrappedJSObject;
31 test.ok = ok;
32 test.finishTest = continueToNextStep;
33 test.runTest();
34 yield undefined;
35
36 // Test for IDBKeyRange and indexedDB availability in JS sandboxes.
37 let principal = Cc["@mozilla.org/systemprincipal;1"].
38 createInstance(Ci.nsIPrincipal);
39 let sandbox = new Cu.Sandbox(principal,
40 { wantGlobalProperties: ["indexedDB"] });
41 sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js");
42 Cu.evalInSandbox(
43 "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \
44 .createInstance(Components.interfaces.mozIJSSubScriptLoader) \
45 .loadSubScript(__SCRIPT_URI_SPEC__);", sandbox, "1.7");
46 sandbox.ok = ok;
47 sandbox.finishTest = continueToNextStep;
48 Cu.evalInSandbox("runTest();", sandbox);
49 yield undefined;
50
51 finishTest();
52 yield undefined;
53 }
54
55 this.runTest = function() {
56 do_get_profile();
57
58 do_test_pending();
59 testGenerator.next();
60 }

mercurial