зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1100664: Make test case browser/base/content/test/general/browser_minimize.js more e10s friendly by using add_task() and support for querying active state added in bug 1199765. r=jimm
--HG-- extra : rebase_source : 5a26b9382bc68b570feec964a0ec56c52ba75124
This commit is contained in:
Родитель
d346e51c8d
Коммит
8eeed2459b
|
@ -1,37 +1,18 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
function waitForActive() {
|
||||
if (!gBrowser.docShell.isActive) {
|
||||
executeSoon(waitForActive);
|
||||
return;
|
||||
}
|
||||
is(gBrowser.docShell.isActive, true, "Docshell should be active again");
|
||||
finish();
|
||||
}
|
||||
|
||||
function waitForInactive() {
|
||||
if (gBrowser.docShell.isActive) {
|
||||
executeSoon(waitForInactive);
|
||||
return;
|
||||
}
|
||||
is(gBrowser.docShell.isActive, false, "Docshell should be inactive");
|
||||
window.restore();
|
||||
waitForActive();
|
||||
}
|
||||
|
||||
function test() {
|
||||
add_task(function *() {
|
||||
registerCleanupFunction(function() {
|
||||
window.restore();
|
||||
});
|
||||
|
||||
waitForExplicitFinish();
|
||||
is(gBrowser.docShell.isActive, true, "Docshell should be active");
|
||||
function waitForActive() { return gBrowser.selectedTab.linkedBrowser.docShellIsActive; }
|
||||
function waitForInactive() { return !gBrowser.selectedTab.linkedBrowser.docShellIsActive; }
|
||||
yield promiseWaitForCondition(waitForActive);
|
||||
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active");
|
||||
window.minimize();
|
||||
// XXX On Linux minimize/restore seem to be very very async, but
|
||||
// our window.windowState changes sync.... so we can't rely on the
|
||||
// latter correctly reflecting the state of the former. In
|
||||
// particular, a restore() call before minimizing is done will not
|
||||
// actually restore the window, but change the window state. As a
|
||||
// result, just poll waiting for our expected isActive values.
|
||||
waitForInactive();
|
||||
}
|
||||
yield promiseWaitForCondition(waitForInactive);
|
||||
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, false, "Docshell should be Inactive");
|
||||
window.restore();
|
||||
yield promiseWaitForCondition(waitForActive);
|
||||
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active again");
|
||||
});
|
Загрузка…
Ссылка в новой задаче