1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug628061.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); 1.8 + 1.9 +let state = { 1.10 + windows: [{ 1.11 + tabs: [{ 1.12 + entries: [{ url: "about:robots" }], 1.13 + hidden: true, 1.14 + extData: {"tabview-tab": '{"url":"about:robots","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'} 1.15 + },{ 1.16 + entries: [{ url: "about:robots" }], 1.17 + hidden: false, 1.18 + extData: {"tabview-tab": '{"url":"about:robots","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}, 1.19 + }], 1.20 + selected: 2, 1.21 + extData: { 1.22 + "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}', 1.23 + "tabview-group": 1.24 + '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' + 1.25 + '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}' 1.26 + } 1.27 + }] 1.28 +}; 1.29 + 1.30 +function test() { 1.31 + waitForExplicitFinish(); 1.32 + testOne(); 1.33 +} 1.34 + 1.35 +function testOne() { 1.36 + newWindowWithTabView( 1.37 + function(win) { 1.38 + testTwo(); 1.39 + win.close(); 1.40 + }, 1.41 + function(win) { 1.42 + registerCleanupFunction(function() win.close()); 1.43 + is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"), 1.44 + "1", "There is one group"); 1.45 + }); 1.46 +} 1.47 + 1.48 +function testTwo() { 1.49 + newWindowWithState(state, function(win) { 1.50 + registerCleanupFunction(function() win.close()); 1.51 + 1.52 + is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"), 1.53 + "2", "There are two groups"); 1.54 + waitForFocus(finish); 1.55 + }); 1.56 +}