mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 859339 - blur reftests that don't need focus; r=dbaron
This patch opens a second window during non-remote reftests. This second window is used purely as a place to place focus when tests don't need focus themselves. Unfocusing the reftests windows when tests don't require focus means that tests that ought to have needs-focus cause failures more consistently. We don't use a second window for remote reftests. Even though we theoretically could (on desktop platforms, for instance), our primary remote reftest use-cases are for Android and B2G. And those platforms do not support multiple windows.
This commit is contained in:
parent
6752dc564b
commit
8b9c0da90c
@ -110,8 +110,33 @@ RefTestCmdLineHandler.prototype =
|
||||
|
||||
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(nsIWindowWatcher);
|
||||
wwatch.openWindow(null, "chrome://reftest/content/reftest.xul", "_blank",
|
||||
"chrome,dialog=no,all", args);
|
||||
|
||||
function loadReftests() {
|
||||
wwatch.openWindow(null, "chrome://reftest/content/reftest.xul", "_blank",
|
||||
"chrome,dialog=no,all", args);
|
||||
}
|
||||
|
||||
var remote = false;
|
||||
try {
|
||||
remote = prefs.getBoolPref("reftest.remote");
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
// If we are running on a remote machine, assume that we can't open another
|
||||
// window for transferring focus to when tests don't require focus.
|
||||
if (remote) {
|
||||
loadReftests();
|
||||
}
|
||||
else {
|
||||
// This dummy window exists solely for enforcing proper focus discipline.
|
||||
var dummy = wwatch.openWindow(null, "about:blank", "dummy",
|
||||
"chrome,dialog=no,left=800,height=200,width=200,all", null);
|
||||
dummy.onload = function dummyOnload() {
|
||||
dummy.focus();
|
||||
loadReftests();
|
||||
}
|
||||
}
|
||||
|
||||
cmdLine.preventDefault = true;
|
||||
},
|
||||
|
||||
|
@ -378,8 +378,10 @@ function InitAndStartRefTests()
|
||||
DoneTests();
|
||||
}
|
||||
|
||||
// Focus the content browser
|
||||
gBrowser.focus();
|
||||
// Focus the content browser.
|
||||
if (gFocusFilterMode != FOCUS_FILTER_NON_NEEDS_FOCUS_TESTS) {
|
||||
gBrowser.focus();
|
||||
}
|
||||
|
||||
StartTests();
|
||||
}
|
||||
@ -1118,6 +1120,15 @@ function Focus()
|
||||
return true;
|
||||
}
|
||||
|
||||
function Blur()
|
||||
{
|
||||
// On non-remote reftests, this will transfer focus to the dummy window
|
||||
// we created to hold focus for non-needs-focus tests. Buggy tests
|
||||
// (ones which require focus but don't request needs-focus) will then
|
||||
// fail.
|
||||
gContainingWindow.blur();
|
||||
}
|
||||
|
||||
function StartCurrentTest()
|
||||
{
|
||||
gTestLog = [];
|
||||
@ -1150,6 +1161,9 @@ function StartCurrentTest()
|
||||
}
|
||||
else {
|
||||
gDumpLog("REFTEST TEST-START | " + gURLs[0].prettyPath + "\n");
|
||||
if (!gURLs[0].needsFocus) {
|
||||
Blur();
|
||||
}
|
||||
var currentTest = gTotalTests - gURLs.length;
|
||||
gContainingWindow.document.title = "reftest: " + currentTest + " / " + gTotalTests +
|
||||
" (" + Math.floor(100 * (currentTest / gTotalTests)) + "%)";
|
||||
|
Loading…
Reference in New Issue
Block a user