Bug 1379587 - fix tests that rely on scrolling on a not-yet-painted browser, r=mconley.

This commit is contained in:
Florian Quèze 2017-09-15 23:43:56 +02:00
Родитель c02f618414
Коммит 3e165cf69a
2 изменённых файлов: 30 добавлений и 4 удалений

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

@ -98,9 +98,24 @@ function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback
function runTest() {
var win = open('bug574663.html', '_blank', 'width=300,height=300');
SimpleTest.waitForFocus(function () {
let winUtils = SpecialPowers.getDOMWindowUtils(win);
let waitUntilPainted = function(callback) {
// Until the first non-blank paint, the parent will set the opacity of our
// browser to 0 using the 'blank' attribute.
// Until the blank attribute is removed, we can't send scroll events.
SimpleTest.waitForFocus(function() {
SpecialPowers.loadChromeScript(_ => {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.wm.getMostRecentWindow("navigator:browser")
.gBrowser.selectedBrowser.removeAttribute("blank");
});
waitForPaint(win, winUtils, callback);
}, win);
};
waitUntilPainted(function () {
var scrollbox = win.document.getElementById("scrollbox");
let winUtils = SpecialPowers.getDOMWindowUtils(win);
let outstandingTests = [
[false, false],
[false, true],
@ -151,7 +166,7 @@ function runTest() {
sendTouchpadScrollMotion(scrollbox, 1, ctrlKey, isMomentum, check);
}
nextTest();
}, win);
});
}
window.onload = function() {

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

@ -48,7 +48,18 @@
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForFocus(runTests, window);
// Until the first non-blank paint, the parent will set the opacity of our
// browser to 0 using the 'blank' attribute.
// Until the blank attribute is removed, we can't send scroll events.
SimpleTest.waitForFocus(function() {
SpecialPowers.loadChromeScript(_ => {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.wm.getMostRecentWindow("navigator:browser")
.gBrowser.selectedBrowser.removeAttribute("blank");
});
runTests();
}, window);
SimpleTest.requestFlakyTimeout("untriaged");
var winUtils = SpecialPowers.getDOMWindowUtils(window);