Bug 791670 - part 3 - fix newtab page tests; r=jaws

This commit is contained in:
Tim Taubert 2013-06-04 22:20:44 +02:00
Родитель 73acc55f39
Коммит 33a343345c
6 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -30,6 +30,9 @@ let gGrid = {
*/
get sites() [cell.site for each (cell in this.cells)],
// Tells whether the grid has already been initialized.
get ready() !!this._node,
/**
* Initializes the grid.
* @param aSelector The query selector of the grid.

Просмотреть файл

@ -50,7 +50,10 @@ let gPage = {
* Updates the whole page and the grid when the storage has changed.
*/
update: function Page_update() {
// The grid might not be ready yet as we initialize it asynchronously.
if (gGrid.ready) {
gGrid.refresh();
}
},
/**

Просмотреть файл

@ -33,6 +33,8 @@ const EXPECTED_REFLOWS = [
"onxbltransitionend@chrome://browser/content/tabbrowser.xml|"
];
const PREF_PRELOAD = "browser.newtab.preload";
/*
* This test ensures that there are no unexpected
* uninterruptible reflows when opening new tabs.
@ -40,6 +42,9 @@ const EXPECTED_REFLOWS = [
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref(PREF_PRELOAD, false);
registerCleanupFunction(() => Services.prefs.clearUserPref(PREF_PRELOAD));
// Add a reflow observer and open a new tab.
docShell.addWeakReflowObserver(observer);
BrowserOpenTab();

Просмотреть файл

@ -15,4 +15,5 @@ function runTests() {
ok(NewTabUtils.allPages.enabled, "page is enabled");
NewTabUtils.allPages.enabled = false;
ok(getGrid().node.hasAttribute("page-disabled"), "page is disabled");
NewTabUtils.allPages.enabled = true;
}

Просмотреть файл

@ -28,6 +28,7 @@ function runTests() {
yield countFocus(1);
Services.prefs.clearUserPref("accessibility.tabfocus");
NewTabUtils.allPages.enabled = true;
}
/**

Просмотреть файл

@ -227,7 +227,10 @@ function addNewTabPageTab() {
executeSoon(TestRunner.next);
});
} else {
TestRunner.next();
// It's important that we call next() asynchronously.
// 'yield addNewTabPageTab()' would fail if next() is called
// synchronously because the iterator is already executing.
executeSoon(TestRunner.next);
}
}