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