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.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | "use strict"; |
michael@0 | 5 | |
michael@0 | 6 | // Tests exports from Timer.jsm |
michael@0 | 7 | |
michael@0 | 8 | let imported = {}; |
michael@0 | 9 | Components.utils.import("resource://gre/modules/Timer.jsm", imported); |
michael@0 | 10 | |
michael@0 | 11 | function run_test(browser, tab, document) { |
michael@0 | 12 | do_test_pending(); |
michael@0 | 13 | |
michael@0 | 14 | let timeout1 = imported.setTimeout(function() do_throw("Should not be called"), 100); |
michael@0 | 15 | do_check_eq(typeof timeout1, "number", "setTimeout returns a number"); |
michael@0 | 16 | do_check_true(timeout1 > 0, "setTimeout returns a positive number"); |
michael@0 | 17 | |
michael@0 | 18 | let timeout2 = imported.setTimeout(function(param1, param2) { |
michael@0 | 19 | do_check_true(true, "Should be called"); |
michael@0 | 20 | do_check_eq(param1, 5, "first parameter is correct"); |
michael@0 | 21 | do_check_eq(param2, "test", "second parameter is correct"); |
michael@0 | 22 | do_test_finished(); |
michael@0 | 23 | }, 100, 5, "test"); |
michael@0 | 24 | |
michael@0 | 25 | do_check_eq(typeof timeout2, "number", "setTimeout returns a number"); |
michael@0 | 26 | do_check_true(timeout2 > 0, "setTimeout returns a positive number"); |
michael@0 | 27 | do_check_neq(timeout1, timeout2, "Calling setTimeout again returns a different value"); |
michael@0 | 28 | |
michael@0 | 29 | imported.clearTimeout(timeout1); |
michael@0 | 30 | } |