Bug 521282 - Make sure the browser window is focused before each test. r=mano

This commit is contained in:
Dão Gottwald 2009-11-22 15:05:54 +01:00
Родитель 7045f193a7
Коммит 10f004427c
4 изменённых файлов: 16 добавлений и 23 удалений

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

@ -38,10 +38,6 @@
function test() {
waitForExplicitFinish();
waitForFocus(continue_test);
}
function continue_test() {
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
charsToDelete = 5;

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

@ -1,13 +1,4 @@
function test() {
waitForExplicitFinish();
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
window) {
setTimeout(test, 0);
window.focus();
return;
}
gPrefService.setBoolPref("browser.ctrlTab.previews", true);
gBrowser.addTab();
@ -87,8 +78,6 @@ function test() {
if (gPrefService.prefHasUserValue("browser.ctrlTab.previews"))
gPrefService.clearUserPref("browser.ctrlTab.previews");
finish();
/* private utility functions */
function pressCtrlTab(aShiftKey)

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

@ -10,14 +10,7 @@ var gTabMoveCount = 0;
var gPageLoadCount = 0;
function test() {
waitForExplicitFinish();
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
window) {
setTimeout(test, 0);
window.focus();
return;
}
waitForExplicitFinish();
var windows = Application.windows;
ok(windows, "Check access to browser windows");

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

@ -109,6 +109,21 @@ Tester.prototype = {
return;
}
// Make sure the window is raised before each test.
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
if (fm.activeWindow != window) {
this.dumper.dump("Waiting for window activation...\n");
let self = this;
window.addEventListener("activate", function () {
window.removeEventListener("activate", arguments.callee, false);
setTimeout(function () {
self.execTest();
}, 0);
}, false);
window.focus();
return;
}
// Move to the next test (or first test).
this.step();