michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: // create two groups and each group has one tab item michael@0: let newState = { michael@0: windows: [{ michael@0: tabs: [{ michael@0: entries: [{ url: "about:mozilla" }], michael@0: hidden: true, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": michael@0: '{"bounds":{"left":21,"top":29,"width":204,"height":153},' + michael@0: '"userSize":null,"url":"about:mozilla","groupID":1,' + michael@0: '"imageData":null,"title":null}' michael@0: } michael@0: },{ michael@0: entries: [{ url: "about:blank" }], michael@0: hidden: false, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": michael@0: '{"bounds":{"left":315,"top":29,"width":111,"height":84},' + 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":5,"width":280,"height":232},' + michael@0: '"userSize":null,"title":"","id":1},' + michael@0: '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' + michael@0: '"userSize":null,"title":"","id":2}}', michael@0: "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}' michael@0: }, sizemode:"normal" michael@0: }] michael@0: }; michael@0: michael@0: newWindowWithState(newState, function(win) { michael@0: registerCleanupFunction(function () win.close()); michael@0: michael@0: let selectedTab = win.gBrowser.selectedTab; michael@0: michael@0: win.addEventListener("tabviewframeinitialized", function onInit() { michael@0: win.removeEventListener("tabviewframeinitialized", onInit, false); michael@0: // ensure the TabView.contentWindow is set. michael@0: executeSoon(function() { michael@0: let cw = win.TabView.getContentWindow(); michael@0: michael@0: is(cw.GroupItems.groupItems.length, 2, "There are two groups"); michael@0: is(cw.GroupItems.getActiveGroupItem().id, 1, "The active group item is 1"); michael@0: isnot(selectedTab, win.gBrowser.selectedTab, "The selected tab is different"); michael@0: michael@0: finish(); michael@0: }); michael@0: }, false); michael@0: michael@0: goToNextGroup(win); michael@0: }); michael@0: }