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/ */
5 function test() {
6 waitForExplicitFinish();
8 // create two groups and each group has one tab item
9 let newState = {
10 windows: [{
11 tabs: [{
12 entries: [{ url: "about:mozilla" }],
13 hidden: true,
14 attributes: {},
15 extData: {
16 "tabview-tab":
17 '{"bounds":{"left":21,"top":29,"width":204,"height":153},' +
18 '"userSize":null,"url":"about:mozilla","groupID":1,' +
19 '"imageData":null,"title":null}'
20 }
21 },{
22 entries: [{ url: "about:blank" }],
23 hidden: false,
24 attributes: {},
25 extData: {
26 "tabview-tab":
27 '{"bounds":{"left":315,"top":29,"width":111,"height":84},' +
28 '"userSize":null,"url":"about:blank","groupID":2,' +
29 '"imageData":null,"title":null}'
30 },
31 }],
32 selected:2,
33 _closedTabs: [],
34 extData: {
35 "tabview-groups": '{"nextID":3,"activeGroupId":2}',
36 "tabview-group":
37 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' +
38 '"userSize":null,"title":"","id":1},' +
39 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' +
40 '"userSize":null,"title":"","id":2}}',
41 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}'
42 }, sizemode:"normal"
43 }]
44 };
46 newWindowWithState(newState, function(win) {
47 registerCleanupFunction(function () win.close());
49 let selectedTab = win.gBrowser.selectedTab;
51 win.addEventListener("tabviewframeinitialized", function onInit() {
52 win.removeEventListener("tabviewframeinitialized", onInit, false);
53 // ensure the TabView.contentWindow is set.
54 executeSoon(function() {
55 let cw = win.TabView.getContentWindow();
57 is(cw.GroupItems.groupItems.length, 2, "There are two groups");
58 is(cw.GroupItems.getActiveGroupItem().id, 1, "The active group item is 1");
59 isnot(selectedTab, win.gBrowser.selectedTab, "The selected tab is different");
61 finish();
62 });
63 }, false);
65 goToNextGroup(win);
66 });
67 }