|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests if the preferred source is shown when a page is loaded and |
|
6 * the preferred source is specified before any other source was shown. |
|
7 */ |
|
8 |
|
9 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; |
|
10 const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js"; |
|
11 |
|
12 let gTab, gDebuggee, gPanel, gDebugger; |
|
13 let gSources; |
|
14 |
|
15 function test() { |
|
16 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
|
17 gTab = aTab; |
|
18 gDebuggee = aDebuggee; |
|
19 gPanel = aPanel; |
|
20 gDebugger = gPanel.panelWin; |
|
21 gSources = gDebugger.DebuggerView.Sources; |
|
22 |
|
23 waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest); |
|
24 }); |
|
25 } |
|
26 |
|
27 function finishTest() { |
|
28 info("Currently preferred source: " + gSources.preferredValue); |
|
29 info("Currently selected source: " + gSources.selectedValue); |
|
30 |
|
31 is(gSources.preferredValue, PREFERRED_URL, |
|
32 "The preferred source url wasn't set correctly."); |
|
33 is(gSources.selectedValue, PREFERRED_URL, |
|
34 "The selected source isn't the correct one."); |
|
35 |
|
36 closeDebuggerAndFinish(gPanel); |
|
37 } |
|
38 |
|
39 function prepareDebugger(aPanel) { |
|
40 aPanel._view.Sources.preferredSource = PREFERRED_URL; |
|
41 } |
|
42 |
|
43 registerCleanupFunction(function() { |
|
44 gTab = null; |
|
45 gDebuggee = null; |
|
46 gPanel = null; |
|
47 gDebugger = null; |
|
48 gSources = null; |
|
49 }); |