author | Tim Taubert <tim.taubert@gmx.de> |
Thu, 14 Apr 2011 06:10:50 +0200 | |
changeset 68172 | 3b690b386210031535984dd956afb6da9e193a01 |
parent 68171 | 91e04bb4308f48861b1484b421d3e824f6a5df87 |
child 68173 | 784db2f4b6acadf9e24a6d37b308392082d08097 |
push id | 19528 |
push user | eakhgari@mozilla.com |
push date | Fri, 15 Apr 2011 13:35:33 +0000 |
treeherder | mozilla-central@754e793c647e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ian |
bugs | 644584, 602432 |
milestone | 6.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/base/content/test/tabview/browser_tabview_bug602432.js | file | annotate | diff | comparison | revisions |
--- a/browser/base/content/test/tabview/browser_tabview_bug602432.js +++ b/browser/base/content/test/tabview/browser_tabview_bug602432.js @@ -1,72 +1,45 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ function test() { - waitForExplicitFinish(); - newWindowWithTabView(onTabViewWindowLoaded); -} - -let contentWindow = null; - -function onTabViewWindowLoaded(win) { - ok(win.TabView.isVisible(), "Tab View is visible"); - - contentWindow = win.TabView.getContentWindow(); - - // Preparation - // - let numTabs = 10; - let groupItem = createGroupItemWithBlankTabs(win, 150, 150, 100, - numTabs, false); - - // Ensure that group is stacked - ok(groupItem.isStacked(), "Group item is stacked"); + let checkUpdateTimes = function (groupItem) { + let children = groupItem.getChildren(); + let earliestUpdateTime = children.shift()._testLastTabUpdateTime; - // Force updates to be deferred - contentWindow.TabItems.pausePainting(); - let children = groupItem.getChildren(); - is(children.length, numTabs, "Correct number of tabitems created"); - - let leftToUpdate = numTabs; - let testFunc = function(tabItem) { - tabItem.removeSubscriber(tabItem, "updated"); - if (--leftToUpdate>0) - return; - // Now that everything is updated, compare update times. - // All tabs in the group should have updated AFTER the first one. - let earliest = children[0]._lastTabUpdateTime; - for (let c=1; c<children.length; ++c) - ok(earliest <= children[c]._lastTabUpdateTime, - "Stacked group item update ("+children[c]._lastTabUpdateTime+") > first item ("+earliest+")"); - shutDown(win, groupItem); - }; - - for (let c=0; c<children.length; ++c) { - let tabItem = children[c]; - tabItem.addSubscriber(tabItem, "updated", testFunc); - contentWindow.TabItems.update(tabItem.tab); + children.forEach(function (tabItem) { + let updateTime = tabItem._testLastTabUpdateTime; + ok(earliestUpdateTime <= updateTime, "Stacked group item update (" + + updateTime + ") > first item (" + earliestUpdateTime + ")"); + }); } - // Let the update queue start again - contentWindow.TabItems.resumePainting(); -} + waitForExplicitFinish(); + + newWindowWithTabView(function (win) { + registerCleanupFunction(function () win.close()); + + let numTabsToUpdate = 10; + let groupItem = createGroupItemWithBlankTabs(win, 150, 150, 100, numTabsToUpdate, false); + ok(groupItem.isStacked(), "groupItem is stacked"); + + let cw = win.TabView.getContentWindow(); + cw.TabItems.pausePainting(); -function shutDown(win, groupItem) { - // Shut down - let groupItemCount = contentWindow.GroupItems.groupItems.length; - closeGroupItem(groupItem, function() { - // check the number of groups. - is(contentWindow.GroupItems.groupItems.length, --groupItemCount, - "The number of groups is decreased by 1"); - let onTabViewHidden = function() { - win.removeEventListener("tabviewhidden", onTabViewHidden, false); - // assert that we're no longer in tab view - ok(!TabView.isVisible(), "Tab View is hidden"); - win.close(); - ok(win.closed, "new window is closed"); - finish(); - }; - win.addEventListener("tabviewhidden", onTabViewHidden, false); - win.TabView.toggle(); + groupItem.getChildren().forEach(function (tabItem) { + tabItem.addSubscriber(tabItem, "updated", function () { + tabItem.removeSubscriber(tabItem, "updated"); + tabItem._testLastTabUpdateTime = tabItem._lastTabUpdateTime; + + if (--numTabsToUpdate) + return; + + checkUpdateTimes(groupItem); + finish(); + }); + + cw.TabItems.update(tabItem.tab); + }); + + cw.TabItems.resumePainting(); }); }