browser/components/tabview/test/browser_tabview_bug706430.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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 let state1 = {
     5   windows: [{
     6     tabs: [{
     7       entries: [{ url: "about:blank#1" }],
     8       hidden: true,
     9       extData: {"tabview-tab": '{"url":"about:blank#1","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'}
    10     },{
    11       entries: [{ url: "about:blank#2" }],
    12       hidden: false,
    13       extData: {"tabview-tab": '{"url":"about:blank#2","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
    14     }],
    15     selected: 2,
    16     extData: {
    17       "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
    18       "tabview-group":
    19         '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
    20         '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
    21     }
    22   }]
    23 };
    25 let state2 = {
    26   windows: [{
    27     tabs: [{entries: [{ url: "about:blank#1" }], hidden: true},
    28            {entries: [{ url: "about:blank#2" }], hidden: false}],
    29     selected: 2
    30   }]
    31 };
    33 let ss = Cc["@mozilla.org/browser/sessionstore;1"]
    34          .getService(Ci.nsISessionStore);
    36 function test() {
    37   waitForExplicitFinish();
    39   newWindowWithState(state1, function (win) {
    40     registerCleanupFunction(function () win.close());
    42     showTabView(function () {
    43       let cw = win.TabView.getContentWindow();
    44       let [group1, group2] = cw.GroupItems.groupItems;
    45       let [tab1, tab2] = win.gBrowser.tabs;
    47       checkUrl(group1.getChild(0), "about:blank#1", "tab1 is in first group");
    48       checkUrl(group2.getChild(0), "about:blank#2", "tab2 is in second group");
    50       whenWindowStateReady(win, function () {
    51         let groups = cw.GroupItems.groupItems;
    52         is(groups.length, 1, "one groupItem");
    53         is(groups[0].getChildren().length, 2, "single groupItem has two children");
    55         finish();
    56       });
    58       ss.setWindowState(win, JSON.stringify(state2), true);
    59     }, win);
    60   });
    61 }
    63 function checkUrl(aTabItem, aUrl, aMsg) {
    64   is(aTabItem.tab.linkedBrowser.currentURI.spec, aUrl, aMsg);
    65 }

mercurial