michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Test that if we black box a source and then refresh, it is still black boxed. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_binary_search.html"; michael@0: michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: michael@0: function test() { michael@0: initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { michael@0: gTab = aTab; michael@0: gDebuggee = aDebuggee; michael@0: gPanel = aPanel; michael@0: gDebugger = gPanel.panelWin; michael@0: michael@0: waitForSourceShown(gPanel, ".coffee") michael@0: .then(testBlackBoxSource) michael@0: .then(testBlackBoxReload) michael@0: .then(() => closeDebuggerAndFinish(gPanel)) michael@0: .then(null, aError => { michael@0: ok(false, "Got an error: " + aError.message + "\n" + aError.stack); michael@0: }); michael@0: }); michael@0: } michael@0: michael@0: function testBlackBoxSource() { michael@0: const bbButton = getBlackBoxButton(gPanel); michael@0: ok(!bbButton.checked, "Should not be black boxed by default"); michael@0: michael@0: return toggleBlackBoxing(gPanel).then(aSource => { michael@0: ok(aSource.isBlackBoxed, "The source should be black boxed now."); michael@0: ok(bbButton.checked, "The checkbox should no longer be checked."); michael@0: }); michael@0: } michael@0: michael@0: function testBlackBoxReload() { michael@0: return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => { michael@0: const bbButton = getBlackBoxButton(gPanel); michael@0: ok(bbButton.checked, "Should still be black boxed."); michael@0: }); michael@0: } michael@0: michael@0: registerCleanupFunction(function() { michael@0: gTab = null; michael@0: gDebuggee = null; michael@0: gPanel = null; michael@0: gDebugger = null; michael@0: });