Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Tests the API for saving global session data.
5 function runTests() {
6 const key1 = "Unique name 1: " + Date.now();
7 const key2 = "Unique name 2: " + Date.now();
8 const value1 = "Unique value 1: " + Math.random();
9 const value2 = "Unique value 2: " + Math.random();
11 let global = {};
12 global[key1] = value1;
14 const testState = {
15 windows: [
16 {
17 tabs: [
18 { entries: [{ url: "about:blank" }] },
19 ]
20 }
21 ],
22 global: global
23 };
25 function testRestoredState() {
26 is(ss.getGlobalValue(key1), value1, "restored state has global value");
27 }
29 function testGlobalStore() {
30 is(ss.getGlobalValue(key2), "", "global value initially not set");
32 ss.setGlobalValue(key2, value1);
33 is(ss.getGlobalValue(key2), value1, "retreived value matches stored");
35 ss.setGlobalValue(key2, value2);
36 is(ss.getGlobalValue(key2), value2, "previously stored value was overwritten");
38 ss.deleteGlobalValue(key2);
39 is(ss.getGlobalValue(key2), "", "global value was deleted");
40 }
42 yield waitForBrowserState(testState, next);
43 testRestoredState();
44 testGlobalStore();
45 }
47 function test() {
48 TestRunner.run();
49 }