Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | let win, contentWindow, originalTab, newTab1, newTab2; |
michael@0 | 6 | |
michael@0 | 7 | let partOne = function () { |
michael@0 | 8 | let groupItem = contentWindow.GroupItems.groupItems[0]; |
michael@0 | 9 | let tabItems = groupItem.getChildren(); |
michael@0 | 10 | is(tabItems.length, 2, "There are two tab items in that group item"); |
michael@0 | 11 | is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab"); |
michael@0 | 12 | is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab"); |
michael@0 | 13 | |
michael@0 | 14 | hideTabView(partTwo, win); |
michael@0 | 15 | }; |
michael@0 | 16 | |
michael@0 | 17 | let partTwo = function () { |
michael@0 | 18 | win.gBrowser.unpinTab(newTab1); |
michael@0 | 19 | showTabView(partThree, win); |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | let partThree = function () { |
michael@0 | 23 | let tabItems = contentWindow.GroupItems.groupItems[0].getChildren(); |
michael@0 | 24 | is(tabItems.length, 3, "There are three tab items in that group item"); |
michael@0 | 25 | is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab"); |
michael@0 | 26 | is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab"); |
michael@0 | 27 | is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab"); |
michael@0 | 28 | |
michael@0 | 29 | finish(); |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | let onLoad = function (tvwin) { |
michael@0 | 33 | win = tvwin; |
michael@0 | 34 | registerCleanupFunction(function () win.close()); |
michael@0 | 35 | |
michael@0 | 36 | for (let i = 0; i < 2; i++) |
michael@0 | 37 | win.gBrowser.loadOneTab("about:blank", {inBackground: true}); |
michael@0 | 38 | |
michael@0 | 39 | [originalTab, newTab1, newTab2] = win.gBrowser.tabs; |
michael@0 | 40 | win.gBrowser.pinTab(newTab1); |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | let onShow = function () { |
michael@0 | 44 | contentWindow = win.TabView.getContentWindow(); |
michael@0 | 45 | is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item"); |
michael@0 | 46 | |
michael@0 | 47 | partOne(); |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | waitForExplicitFinish(); |
michael@0 | 51 | newWindowWithTabView(onShow, onLoad); |
michael@0 | 52 | } |