|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 waitForExplicitFinish(); |
|
6 |
|
7 const DUMMY_PAGE_URL = "about:blank"; |
|
8 const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/"; |
|
9 |
|
10 // create two groups and each group has one tab item |
|
11 let newState = { |
|
12 windows: [{ |
|
13 tabs: [{ |
|
14 entries: [{ url: DUMMY_PAGE_URL }], |
|
15 hidden: true, |
|
16 attributes: {}, |
|
17 extData: { |
|
18 "tabview-tab": |
|
19 '{"bounds":{"left":21,"top":29,"width":204,"height":153},' + |
|
20 '"userSize":null,"url":"' + DUMMY_PAGE_URL + '","groupID":1,' + |
|
21 '"imageData":null,"title":null}' |
|
22 } |
|
23 },{ |
|
24 entries: [{ url: DUMMY_PAGE_URL_2 }], |
|
25 hidden: false, |
|
26 attributes: {}, |
|
27 extData: { |
|
28 "tabview-tab": |
|
29 '{"bounds":{"left":315,"top":29,"width":111,"height":84},' + |
|
30 '"userSize":null,"url":"' + DUMMY_PAGE_URL_2 + '","groupID":2,' + |
|
31 '"imageData":null,"title":null}' |
|
32 }, |
|
33 }], |
|
34 selected:2, |
|
35 _closedTabs: [], |
|
36 extData: { |
|
37 "tabview-groups": '{"nextID":3,"activeGroupId":2}', |
|
38 "tabview-group": |
|
39 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' + |
|
40 '"userSize":null,"title":"","id":1},' + |
|
41 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' + |
|
42 '"userSize":null,"title":"","id":2}}', |
|
43 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}' |
|
44 }, sizemode:"normal" |
|
45 }] |
|
46 }; |
|
47 |
|
48 newWindowWithState(newState, function(win) { |
|
49 registerCleanupFunction(function () win.close()); |
|
50 |
|
51 whenTabViewIsShown(function() { |
|
52 let contentWindow = win.TabView.getContentWindow(); |
|
53 |
|
54 is(contentWindow.GroupItems.groupItems.length, 2, "There are still two groups"); |
|
55 is(win.gBrowser.tabs.length, 1, "There is only one tab"); |
|
56 |
|
57 finish(); |
|
58 }, win); |
|
59 win.gBrowser.removeTab(win.gBrowser.selectedTab); |
|
60 }); |
|
61 } |
|
62 |