browser/base/content/test/general/browser_visibleTabs_bookmarkAllPages.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_visibleTabs_bookmarkAllPages.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +function test() {
     1.9 +  waitForExplicitFinish();
    1.10 +
    1.11 +  let tabOne = gBrowser.addTab("about:blank");
    1.12 +  let tabTwo = gBrowser.addTab("http://mochi.test:8888/");
    1.13 +  gBrowser.selectedTab = tabTwo;
    1.14 +
    1.15 +  let browser = gBrowser.getBrowserForTab(tabTwo);
    1.16 +  let onLoad = function() {
    1.17 +    browser.removeEventListener("load", onLoad, true);
    1.18 +
    1.19 +    gBrowser.showOnlyTheseTabs([tabTwo]);
    1.20 +
    1.21 +    is(gBrowser.visibleTabs.length, 1, "Only one tab is visible");
    1.22 +
    1.23 +    let uris = PlacesCommandHook.uniqueCurrentPages;
    1.24 +    is(uris.length, 1, "Only one uri is returned");
    1.25 +
    1.26 +    is(uris[0].spec, tabTwo.linkedBrowser.currentURI.spec, "It's the correct URI");
    1.27 +
    1.28 +    gBrowser.removeTab(tabOne);
    1.29 +    gBrowser.removeTab(tabTwo);
    1.30 +    Array.forEach(gBrowser.tabs, function(tab) {
    1.31 +      gBrowser.showTab(tab);
    1.32 +    });
    1.33 +
    1.34 +    finish();
    1.35 +  }
    1.36 +  browser.addEventListener("load", onLoad, true);
    1.37 +}

mercurial