|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 TestRunner.run(); |
|
6 } |
|
7 |
|
8 function runTests() { |
|
9 function assertNumberOfTabs(num, msg) { |
|
10 is(gBrowser.tabs.length, num, msg); |
|
11 } |
|
12 |
|
13 function assertNumberOfPinnedTabs(num, msg) { |
|
14 is(gBrowser._numPinnedTabs, num, msg); |
|
15 } |
|
16 |
|
17 // check prerequisites |
|
18 assertNumberOfTabs(1, "we start off with one tab"); |
|
19 assertNumberOfPinnedTabs(0, "no pinned tabs so far"); |
|
20 |
|
21 // setup |
|
22 gBrowser.addTab("about:blank"); |
|
23 assertNumberOfTabs(2, "there are two tabs, now"); |
|
24 |
|
25 let [tab1, tab2] = gBrowser.tabs; |
|
26 let linkedBrowser = tab1.linkedBrowser; |
|
27 gBrowser.pinTab(tab1); |
|
28 gBrowser.pinTab(tab2); |
|
29 assertNumberOfPinnedTabs(2, "both tabs are now pinned"); |
|
30 |
|
31 // run the test |
|
32 yield waitForBrowserState( |
|
33 { windows: [{ tabs: [{ url: "about:blank" }] }] }, |
|
34 function () { |
|
35 assertNumberOfTabs(1, "one tab left after setBrowserState()"); |
|
36 assertNumberOfPinnedTabs(0, "there are no pinned tabs"); |
|
37 is(gBrowser.tabs[0].linkedBrowser, linkedBrowser, "first tab's browser got re-used"); |
|
38 next(); |
|
39 } |
|
40 ); |
|
41 } |