browser/components/tabview/test/browser_tabview_bug678374.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:2a1356920ff1
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 const ICON_URL = "moz-anno:favicon:http://example.com/browser/browser/components/tabview/test/test_bug678374_icon16.png";
5 const TEST_URL = "http://example.com/browser/browser/components/tabview/test/test_bug678374.html";
6
7 function test() {
8 Services.prefs.setBoolPref("browser.chrome.favicons", false);
9
10 waitForExplicitFinish();
11
12 newWindowWithTabView(function(win) {
13 is(win.gBrowser.tabs.length, 3, "There are 3 tabs")
14
15 let newTabOne = win.gBrowser.tabs[1];
16 let newTabTwo = win.gBrowser.tabs[2];
17 let cw = win.TabView.getContentWindow();
18 let groupItem = cw.GroupItems.groupItems[0];
19
20 // test tab item
21 let newTabItemOne = newTabOne._tabViewTabItem;
22
23 newTabItemOne.addSubscriber("iconUpdated", function onIconUpdated() {
24 newTabItemOne.removeSubscriber("iconUpdated", onIconUpdated);
25 is(newTabItemOne.$favImage[0].src, ICON_URL, "The tab item is showing the right icon.");
26
27 // test pin tab
28 whenAppTabIconAdded(groupItem, function() {
29 let icon = cw.iQ(".appTabIcon", groupItem.$appTabTray)[0];
30 is(icon.src, ICON_URL, "The app tab is showing the right icon");
31
32 finish();
33 });
34 win.gBrowser.pinTab(newTabTwo);
35 });
36 }, function(win) {
37 registerCleanupFunction(function() {
38 Services.prefs.clearUserPref("browser.chrome.favicons");
39 win.close();
40 });
41
42 win.gBrowser.loadOneTab(TEST_URL);
43 win.gBrowser.loadOneTab(TEST_URL);
44 });
45 }

mercurial