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 cw; |
michael@0 | 6 | |
michael@0 | 7 | let createGroupItem = function () { |
michael@0 | 8 | let bounds = new cw.Rect(20, 20, 200, 200); |
michael@0 | 9 | let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true}); |
michael@0 | 10 | |
michael@0 | 11 | cw.UI.setActive(groupItem); |
michael@0 | 12 | gBrowser.loadOneTab('about:blank', {inBackground: true}); |
michael@0 | 13 | |
michael@0 | 14 | return groupItem; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | let finishTest = function () { |
michael@0 | 18 | ok(!TabView.isVisible(), 'cleanup: tabview is hidden'); |
michael@0 | 19 | is(gBrowser.tabs.length, 1, 'cleanup: there is one tab, only'); |
michael@0 | 20 | is(cw.GroupItems.groupItems.length, 1, 'cleanup: there is one group, only'); |
michael@0 | 21 | |
michael@0 | 22 | finish(); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | let testAddChildFromAnotherGroup = function () { |
michael@0 | 26 | let sourceGroup = cw.GroupItems.groupItems[0]; |
michael@0 | 27 | let targetGroup = createGroupItem(); |
michael@0 | 28 | |
michael@0 | 29 | afterAllTabsLoaded(function () { |
michael@0 | 30 | // check setup |
michael@0 | 31 | is(sourceGroup.getChildren().length, 1, 'setup: source group has one child'); |
michael@0 | 32 | is(targetGroup.getChildren().length, 1, 'setup: target group has one child'); |
michael@0 | 33 | |
michael@0 | 34 | let tabItem = sourceGroup.getChild(0); |
michael@0 | 35 | targetGroup.add(tabItem); |
michael@0 | 36 | |
michael@0 | 37 | // check state after adding tabItem to targetGroup |
michael@0 | 38 | is(tabItem.parent, targetGroup, 'tabItem changed groups'); |
michael@0 | 39 | is(cw.GroupItems.groupItems.length, 1, 'source group was closed automatically'); |
michael@0 | 40 | is(targetGroup.getChildren().length, 2, 'target group has now two children'); |
michael@0 | 41 | |
michael@0 | 42 | // cleanup and finish |
michael@0 | 43 | targetGroup.getChild(0).close(); |
michael@0 | 44 | hideTabView(finishTest); |
michael@0 | 45 | }); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | waitForExplicitFinish(); |
michael@0 | 49 | |
michael@0 | 50 | showTabView(function () { |
michael@0 | 51 | cw = TabView.getContentWindow(); |
michael@0 | 52 | testAddChildFromAnotherGroup(); |
michael@0 | 53 | }); |
michael@0 | 54 | } |