browser/components/sessionstore/test/browser_624727.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   TestRunner.run();
     6 }
     8 function runTests() {
     9   function assertNumberOfTabs(num, msg) {
    10     is(gBrowser.tabs.length, num, msg);
    11   }
    13   function assertNumberOfPinnedTabs(num, msg) {
    14     is(gBrowser._numPinnedTabs, num, msg);
    15   }
    17   // check prerequisites
    18   assertNumberOfTabs(1, "we start off with one tab");
    19   assertNumberOfPinnedTabs(0, "no pinned tabs so far");
    21   // setup
    22   gBrowser.addTab("about:blank");
    23   assertNumberOfTabs(2, "there are two tabs, now");
    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");
    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 }

mercurial