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