1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug631662.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + let cw; 1.9 + let prefix; 1.10 + let timestamp; 1.11 + 1.12 + let storeTimestamp = function () { 1.13 + timestamp = cw.TabItems._lastUpdateTime; 1.14 + } 1.15 + 1.16 + let checkTimestamp = function () { 1.17 + is(timestamp, cw.TabItems._lastUpdateTime, prefix + 1.18 + ": tabs were not updated"); 1.19 + } 1.20 + 1.21 + let actionAddTab = function () { 1.22 + storeTimestamp(); 1.23 + gBrowser.addTab("about:mozilla"); 1.24 + 1.25 + afterAllTabsLoaded(function () { 1.26 + checkTimestamp(); 1.27 + next(); 1.28 + }); 1.29 + } 1.30 + 1.31 + let actionMoveTab = function () { 1.32 + storeTimestamp(); 1.33 + gBrowser.moveTabTo(gBrowser.tabs[0], 1); 1.34 + gBrowser.moveTabTo(gBrowser.tabs[1], 0); 1.35 + checkTimestamp(); 1.36 + next(); 1.37 + } 1.38 + 1.39 + let actionSelectTab = function () { 1.40 + storeTimestamp(); 1.41 + gBrowser.selectedTab = gBrowser.tabs[1] 1.42 + gBrowser.selectedTab = gBrowser.tabs[0] 1.43 + checkTimestamp(); 1.44 + next(); 1.45 + } 1.46 + 1.47 + let actionRemoveTab = function () { 1.48 + storeTimestamp(); 1.49 + gBrowser.removeTab(gBrowser.tabs[1]); 1.50 + checkTimestamp(); 1.51 + next(); 1.52 + } 1.53 + 1.54 + let actions = [ 1.55 + {name: "add", func: actionAddTab}, 1.56 + {name: "move", func: actionMoveTab}, 1.57 + {name: "select", func: actionSelectTab}, 1.58 + {name: "remove", func: actionRemoveTab} 1.59 + ]; 1.60 + 1.61 + let next = function () { 1.62 + let action = actions.shift(); 1.63 + 1.64 + if (action) { 1.65 + prefix = action.name; 1.66 + action.func(); 1.67 + } else { 1.68 + finish(); 1.69 + } 1.70 + } 1.71 + 1.72 + waitForExplicitFinish(); 1.73 + 1.74 + showTabView(function () { 1.75 + cw = TabView.getContentWindow(); 1.76 + hideTabView(next); 1.77 + }); 1.78 +}