michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let newWin; michael@0: function test() { michael@0: let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); michael@0: michael@0: requestLongerTimeout(2); michael@0: waitForExplicitFinish(); michael@0: michael@0: // open a new window and setup the window state. michael@0: newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", "about:blank"); michael@0: newWin.addEventListener("load", function onLoad(event) { michael@0: this.removeEventListener("load", onLoad, false); michael@0: michael@0: let newState = { michael@0: windows: [{ michael@0: tabs: [{ michael@0: entries: [{ "url": "about:blank" }], michael@0: hidden: true, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": michael@0: '{"bounds":{"left":20,"top":35,"width":280,"height":210},' + michael@0: '"userSize":null,"url":"about:blank","groupID":1,' + michael@0: '"imageData":null,"title":null}' michael@0: } michael@0: },{ michael@0: entries: [{ url: "about:blank" }], michael@0: index: 1, michael@0: hidden: false, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": michael@0: '{"bounds":{"left":375,"top":35,"width":280,"height":210},' + michael@0: '"userSize":null,"url":"about:blank","groupID":2,' + michael@0: '"imageData":null,"title":null}' michael@0: } michael@0: }], michael@0: selected:2, michael@0: _closedTabs: [], michael@0: extData: { michael@0: "tabview-groups": '{"nextID":3,"activeGroupId":2}', michael@0: "tabview-group": michael@0: '{"1":{"bounds":{"left":15,"top":10,"width":320,"height":375},' + michael@0: '"userSize":null,"title":"","id":1},' + michael@0: '"2":{"bounds":{"left":380,"top":5,"width":320,"height":375},' + michael@0: '"userSize":null,"title":"","id":2}}', michael@0: "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":875,"height":650}}' michael@0: }, sizemode:"normal" michael@0: }] michael@0: }; michael@0: ss.setWindowState(newWin, JSON.stringify(newState), true); michael@0: michael@0: // add a new tab. michael@0: newWin.gBrowser.addTab(); michael@0: is(newWin.gBrowser.tabs.length, 3, "There are 3 browser tabs"); michael@0: michael@0: let onTabViewShow = function() { michael@0: newWin.removeEventListener("tabviewshown", onTabViewShow, false); michael@0: michael@0: let contentWindow = newWin.TabView.getContentWindow(); michael@0: is(contentWindow.GroupItems.groupItems.length, 2, "Has two group items"); michael@0: michael@0: // clean up and finish michael@0: newWin.close(); michael@0: michael@0: finish(); michael@0: } michael@0: newWin.addEventListener("tabviewshown", onTabViewShow, false); michael@0: waitForFocus(function() { newWin.TabView.toggle(); }); michael@0: }, false); michael@0: }