|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 let newWin; |
|
5 function test() { |
|
6 let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); |
|
7 |
|
8 requestLongerTimeout(2); |
|
9 waitForExplicitFinish(); |
|
10 |
|
11 // open a new window and setup the window state. |
|
12 newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", "about:blank"); |
|
13 newWin.addEventListener("load", function onLoad(event) { |
|
14 this.removeEventListener("load", onLoad, false); |
|
15 |
|
16 let newState = { |
|
17 windows: [{ |
|
18 tabs: [{ |
|
19 entries: [{ "url": "about:blank" }], |
|
20 hidden: true, |
|
21 attributes: {}, |
|
22 extData: { |
|
23 "tabview-tab": |
|
24 '{"bounds":{"left":20,"top":35,"width":280,"height":210},' + |
|
25 '"userSize":null,"url":"about:blank","groupID":1,' + |
|
26 '"imageData":null,"title":null}' |
|
27 } |
|
28 },{ |
|
29 entries: [{ url: "about:blank" }], |
|
30 index: 1, |
|
31 hidden: false, |
|
32 attributes: {}, |
|
33 extData: { |
|
34 "tabview-tab": |
|
35 '{"bounds":{"left":375,"top":35,"width":280,"height":210},' + |
|
36 '"userSize":null,"url":"about:blank","groupID":2,' + |
|
37 '"imageData":null,"title":null}' |
|
38 } |
|
39 }], |
|
40 selected:2, |
|
41 _closedTabs: [], |
|
42 extData: { |
|
43 "tabview-groups": '{"nextID":3,"activeGroupId":2}', |
|
44 "tabview-group": |
|
45 '{"1":{"bounds":{"left":15,"top":10,"width":320,"height":375},' + |
|
46 '"userSize":null,"title":"","id":1},' + |
|
47 '"2":{"bounds":{"left":380,"top":5,"width":320,"height":375},' + |
|
48 '"userSize":null,"title":"","id":2}}', |
|
49 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":875,"height":650}}' |
|
50 }, sizemode:"normal" |
|
51 }] |
|
52 }; |
|
53 ss.setWindowState(newWin, JSON.stringify(newState), true); |
|
54 |
|
55 // add a new tab. |
|
56 newWin.gBrowser.addTab(); |
|
57 is(newWin.gBrowser.tabs.length, 3, "There are 3 browser tabs"); |
|
58 |
|
59 let onTabViewShow = function() { |
|
60 newWin.removeEventListener("tabviewshown", onTabViewShow, false); |
|
61 |
|
62 let contentWindow = newWin.TabView.getContentWindow(); |
|
63 is(contentWindow.GroupItems.groupItems.length, 2, "Has two group items"); |
|
64 |
|
65 // clean up and finish |
|
66 newWin.close(); |
|
67 |
|
68 finish(); |
|
69 } |
|
70 newWin.addEventListener("tabviewshown", onTabViewShow, false); |
|
71 waitForFocus(function() { newWin.TabView.toggle(); }); |
|
72 }, false); |
|
73 } |