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 | /** |
michael@0 | 5 | * Test that if we black box a source and then refresh, it is still black boxed. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; |
michael@0 | 9 | |
michael@0 | 10 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 11 | |
michael@0 | 12 | function test() { |
michael@0 | 13 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 14 | gTab = aTab; |
michael@0 | 15 | gDebuggee = aDebuggee; |
michael@0 | 16 | gPanel = aPanel; |
michael@0 | 17 | gDebugger = gPanel.panelWin; |
michael@0 | 18 | |
michael@0 | 19 | waitForSourceShown(gPanel, ".coffee") |
michael@0 | 20 | .then(testBlackBoxSource) |
michael@0 | 21 | .then(testBlackBoxReload) |
michael@0 | 22 | .then(() => closeDebuggerAndFinish(gPanel)) |
michael@0 | 23 | .then(null, aError => { |
michael@0 | 24 | ok(false, "Got an error: " + aError.message + "\n" + aError.stack); |
michael@0 | 25 | }); |
michael@0 | 26 | }); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function testBlackBoxSource() { |
michael@0 | 30 | const bbButton = getBlackBoxButton(gPanel); |
michael@0 | 31 | ok(!bbButton.checked, "Should not be black boxed by default"); |
michael@0 | 32 | |
michael@0 | 33 | return toggleBlackBoxing(gPanel).then(aSource => { |
michael@0 | 34 | ok(aSource.isBlackBoxed, "The source should be black boxed now."); |
michael@0 | 35 | ok(bbButton.checked, "The checkbox should no longer be checked."); |
michael@0 | 36 | }); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function testBlackBoxReload() { |
michael@0 | 40 | return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => { |
michael@0 | 41 | const bbButton = getBlackBoxButton(gPanel); |
michael@0 | 42 | ok(bbButton.checked, "Should still be black boxed."); |
michael@0 | 43 | }); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | registerCleanupFunction(function() { |
michael@0 | 47 | gTab = null; |
michael@0 | 48 | gDebuggee = null; |
michael@0 | 49 | gPanel = null; |
michael@0 | 50 | gDebugger = null; |
michael@0 | 51 | }); |