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 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | newWindowWithTabView(win => { |
michael@0 | 8 | win.gBrowser.addTab("http://example.com/"); |
michael@0 | 9 | win.gBrowser.addTab("http://example.com/"); |
michael@0 | 10 | |
michael@0 | 11 | afterAllTabsLoaded(function() { |
michael@0 | 12 | let cw = win.TabView.getContentWindow(); |
michael@0 | 13 | |
michael@0 | 14 | let groupItemOne = cw.GroupItems.groupItems[0]; |
michael@0 | 15 | is(groupItemOne.getChildren().length, 3, "The number of tabs in group one is 3"); |
michael@0 | 16 | |
michael@0 | 17 | // create a group with a blank tab |
michael@0 | 18 | let groupItemTwo = createGroupItemWithBlankTabs(win, 400, 400, 40, 1); |
michael@0 | 19 | is(groupItemTwo.getChildren().length, 1, "The number of tabs in group two is 1"); |
michael@0 | 20 | |
michael@0 | 21 | cw.UI.setActive(groupItemOne); |
michael@0 | 22 | |
michael@0 | 23 | moveTabToAnotherGroup(win, groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() { |
michael@0 | 24 | moveTabToAnotherGroup(win, groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() { |
michael@0 | 25 | groupItemOne.close(); |
michael@0 | 26 | promiseWindowClosed(win).then(finish); |
michael@0 | 27 | }); |
michael@0 | 28 | }); |
michael@0 | 29 | }); |
michael@0 | 30 | }); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function moveTabToAnotherGroup(win, targetTab, groupItemOne, groupItemTwo, callback) { |
michael@0 | 34 | hideTabView(function() { |
michael@0 | 35 | let tabCountInGroupItemOne = groupItemOne.getChildren().length; |
michael@0 | 36 | let tabCountInGroupItemTwo = groupItemTwo.getChildren().length; |
michael@0 | 37 | |
michael@0 | 38 | win.TabView.moveTabTo(targetTab, groupItemTwo.id); |
michael@0 | 39 | |
michael@0 | 40 | showTabView(function() { |
michael@0 | 41 | is(groupItemOne.getChildren().length, --tabCountInGroupItemOne, "The number of tab items in group one is decreased"); |
michael@0 | 42 | is(groupItemTwo.getChildren().length, ++tabCountInGroupItemTwo, "The number of tab items in group two is increased"); |
michael@0 | 43 | is(groupItemTwo.getChild(tabCountInGroupItemTwo-1).tab, targetTab, "The last tab is the moved tab"); |
michael@0 | 44 | |
michael@0 | 45 | callback(); |
michael@0 | 46 | }, win); |
michael@0 | 47 | }, win); |
michael@0 | 48 | } |