michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const ICON_URL = "moz-anno:favicon:http://example.com/browser/browser/components/tabview/test/test_bug678374_icon16.png"; michael@0: const TEST_URL = "http://example.com/browser/browser/components/tabview/test/test_bug678374.html"; michael@0: michael@0: function test() { michael@0: Services.prefs.setBoolPref("browser.chrome.favicons", false); michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function(win) { michael@0: is(win.gBrowser.tabs.length, 3, "There are 3 tabs") michael@0: michael@0: let newTabOne = win.gBrowser.tabs[1]; michael@0: let newTabTwo = win.gBrowser.tabs[2]; michael@0: let cw = win.TabView.getContentWindow(); michael@0: let groupItem = cw.GroupItems.groupItems[0]; michael@0: michael@0: // test tab item michael@0: let newTabItemOne = newTabOne._tabViewTabItem; michael@0: michael@0: newTabItemOne.addSubscriber("iconUpdated", function onIconUpdated() { michael@0: newTabItemOne.removeSubscriber("iconUpdated", onIconUpdated); michael@0: is(newTabItemOne.$favImage[0].src, ICON_URL, "The tab item is showing the right icon."); michael@0: michael@0: // test pin tab michael@0: whenAppTabIconAdded(groupItem, function() { michael@0: let icon = cw.iQ(".appTabIcon", groupItem.$appTabTray)[0]; michael@0: is(icon.src, ICON_URL, "The app tab is showing the right icon"); michael@0: michael@0: finish(); michael@0: }); michael@0: win.gBrowser.pinTab(newTabTwo); michael@0: }); michael@0: }, function(win) { michael@0: registerCleanupFunction(function() { michael@0: Services.prefs.clearUserPref("browser.chrome.favicons"); michael@0: win.close(); michael@0: }); michael@0: michael@0: win.gBrowser.loadOneTab(TEST_URL); michael@0: win.gBrowser.loadOneTab(TEST_URL); michael@0: }); michael@0: }