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