1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-06.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Test that clicking the black box checkbox when paused doesn't re-select the 1.9 + * currently paused frame's source. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; 1.13 + 1.14 +let gTab, gDebuggee, gPanel, gDebugger; 1.15 +let gSources; 1.16 + 1.17 +function test() { 1.18 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.19 + gTab = aTab; 1.20 + gDebuggee = aDebuggee; 1.21 + gPanel = aPanel; 1.22 + gDebugger = gPanel.panelWin; 1.23 + gSources = gDebugger.DebuggerView.Sources; 1.24 + 1.25 + waitForSourceAndCaretAndScopes(gPanel, ".html", 21) 1.26 + .then(testBlackBox) 1.27 + .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) 1.28 + .then(null, aError => { 1.29 + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); 1.30 + }); 1.31 + 1.32 + gDebuggee.runTest(); 1.33 + }); 1.34 +} 1.35 + 1.36 +function testBlackBox() { 1.37 + const selectedUrl = gSources.selectedValue; 1.38 + 1.39 + let finished = waitForSourceShown(gPanel, "blackboxme.js").then(() => { 1.40 + const newSelectedUrl = gSources.selectedValue; 1.41 + isnot(selectedUrl, newSelectedUrl, 1.42 + "Should not have the same url selected."); 1.43 + 1.44 + return toggleBlackBoxing(gPanel).then(() => { 1.45 + is(gSources.selectedValue, newSelectedUrl, 1.46 + "The selected source did not change."); 1.47 + }); 1.48 + }); 1.49 + 1.50 + gSources.selectedIndex = 0; 1.51 + return finished; 1.52 +} 1.53 + 1.54 +registerCleanupFunction(function() { 1.55 + gTab = null; 1.56 + gDebuggee = null; 1.57 + gPanel = null; 1.58 + gDebugger = null; 1.59 + gSources = null; 1.60 +});