browser/components/tabview/test/browser_tabview_bug602432.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug602432.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     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 checkUpdateTimes = function (groupItem) {
     1.9 +    let children = groupItem.getChildren();
    1.10 +    let earliestUpdateTime = children.shift()._testLastTabUpdateTime;
    1.11 +
    1.12 +    children.forEach(function (tabItem) {
    1.13 +      let updateTime = tabItem._testLastTabUpdateTime;
    1.14 +      ok(earliestUpdateTime <= updateTime, "Stacked group item update (" +
    1.15 +         updateTime + ") > first item (" + earliestUpdateTime + ")");
    1.16 +    });
    1.17 +  }
    1.18 +
    1.19 +  waitForExplicitFinish();
    1.20 +
    1.21 +  newWindowWithTabView(function (win) {
    1.22 +    registerCleanupFunction(function () win.close());
    1.23 +
    1.24 +    let numTabsToUpdate = 10;
    1.25 +    let groupItem = createGroupItemWithBlankTabs(win, 150, 150, 100, numTabsToUpdate, false);
    1.26 +    ok(groupItem.isStacked(), "groupItem is stacked");
    1.27 +
    1.28 +    let cw = win.TabView.getContentWindow();
    1.29 +    cw.TabItems.pausePainting();
    1.30 +
    1.31 +    groupItem.getChildren().forEach(function (tabItem) {
    1.32 +      tabItem.addSubscriber("updated", function onUpdated() {
    1.33 +        tabItem.removeSubscriber("updated", onUpdated);
    1.34 +        tabItem._testLastTabUpdateTime = tabItem._lastTabUpdateTime;
    1.35 +
    1.36 +        if (--numTabsToUpdate)
    1.37 +          return;
    1.38 +
    1.39 +        checkUpdateTimes(groupItem);
    1.40 +        finish();
    1.41 +      });
    1.42 +
    1.43 +      cw.TabItems.update(tabItem.tab);
    1.44 +    });
    1.45 +
    1.46 +    cw.TabItems.resumePainting();
    1.47 +  });
    1.48 +}

mercurial