browser/components/tabview/test/browser_tabview_bug628061.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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 const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
michael@0 5
michael@0 6 let state = {
michael@0 7 windows: [{
michael@0 8 tabs: [{
michael@0 9 entries: [{ url: "about:robots" }],
michael@0 10 hidden: true,
michael@0 11 extData: {"tabview-tab": '{"url":"about:robots","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}
michael@0 12 },{
michael@0 13 entries: [{ url: "about:robots" }],
michael@0 14 hidden: false,
michael@0 15 extData: {"tabview-tab": '{"url":"about:robots","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
michael@0 16 }],
michael@0 17 selected: 2,
michael@0 18 extData: {
michael@0 19 "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
michael@0 20 "tabview-group":
michael@0 21 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
michael@0 22 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
michael@0 23 }
michael@0 24 }]
michael@0 25 };
michael@0 26
michael@0 27 function test() {
michael@0 28 waitForExplicitFinish();
michael@0 29 testOne();
michael@0 30 }
michael@0 31
michael@0 32 function testOne() {
michael@0 33 newWindowWithTabView(
michael@0 34 function(win) {
michael@0 35 testTwo();
michael@0 36 win.close();
michael@0 37 },
michael@0 38 function(win) {
michael@0 39 registerCleanupFunction(function() win.close());
michael@0 40 is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
michael@0 41 "1", "There is one group");
michael@0 42 });
michael@0 43 }
michael@0 44
michael@0 45 function testTwo() {
michael@0 46 newWindowWithState(state, function(win) {
michael@0 47 registerCleanupFunction(function() win.close());
michael@0 48
michael@0 49 is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
michael@0 50 "2", "There are two groups");
michael@0 51 waitForFocus(finish);
michael@0 52 });
michael@0 53 }

mercurial