browser/components/tabview/test/browser_tabview_bug712203.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial