browser/components/tabview/test/browser_tabview_bug678374.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug678374.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +const ICON_URL = "moz-anno:favicon:http://example.com/browser/browser/components/tabview/test/test_bug678374_icon16.png";
     1.8 +const TEST_URL = "http://example.com/browser/browser/components/tabview/test/test_bug678374.html";
     1.9 +
    1.10 +function test() {
    1.11 +  Services.prefs.setBoolPref("browser.chrome.favicons", false);
    1.12 +
    1.13 +  waitForExplicitFinish();
    1.14 +
    1.15 +  newWindowWithTabView(function(win) {
    1.16 +    is(win.gBrowser.tabs.length, 3, "There are 3 tabs")
    1.17 +
    1.18 +    let newTabOne = win.gBrowser.tabs[1];
    1.19 +    let newTabTwo = win.gBrowser.tabs[2];
    1.20 +    let cw = win.TabView.getContentWindow();
    1.21 +    let groupItem = cw.GroupItems.groupItems[0];
    1.22 +
    1.23 +    // test tab item
    1.24 +    let newTabItemOne = newTabOne._tabViewTabItem;
    1.25 +
    1.26 +    newTabItemOne.addSubscriber("iconUpdated", function onIconUpdated() {
    1.27 +      newTabItemOne.removeSubscriber("iconUpdated", onIconUpdated);
    1.28 +      is(newTabItemOne.$favImage[0].src, ICON_URL, "The tab item is showing the right icon.");
    1.29 +
    1.30 +      // test pin tab
    1.31 +      whenAppTabIconAdded(groupItem, function() {
    1.32 +        let icon = cw.iQ(".appTabIcon", groupItem.$appTabTray)[0];
    1.33 +        is(icon.src, ICON_URL, "The app tab is showing the right icon");
    1.34 +
    1.35 +        finish();
    1.36 +      });
    1.37 +      win.gBrowser.pinTab(newTabTwo);
    1.38 +    });
    1.39 +  }, function(win) {
    1.40 +    registerCleanupFunction(function() { 
    1.41 +      Services.prefs.clearUserPref("browser.chrome.favicons");
    1.42 +      win.close(); 
    1.43 +   });
    1.44 +
    1.45 +    win.gBrowser.loadOneTab(TEST_URL);
    1.46 +    win.gBrowser.loadOneTab(TEST_URL);
    1.47 +  });
    1.48 +}

mercurial