Commit df24ae69 authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: unflake console-focus.js test

This test was flaky because it logged console messages but did not
wait for the viewport to render their elements in DOM. This CL
unflakes the test by waiting for pending viewport refreshes.

Bug: 789225
Change-Id: I9861b067df72c66b00021050cf07562b0064f66c
Reviewed-on: https://chromium-review.googlesource.com/898389Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533981}
parent ff0336d3
......@@ -582,8 +582,6 @@ crbug.com/778515 http/tests/devtools/elements/styles-3/styles-add-new-rule.js [
crbug.com/785571 http/tests/devtools/console/console-context-selector.js [ Pass Failure ]
crbug.com/789225 http/tests/devtools/console/console-focus.js [ Pass Failure ]
crbug.com/667560 [ Win ] http/tests/devtools/console-cross-origin-iframe-logging.js [ Pass Timeout ]
crbug.com/778391 http/tests/devtools/elements/styles-3/styles-add-new-rule-tab.js [ Pass Failure ]
......
......@@ -23,7 +23,10 @@
}
function logMessages() {
ConsoleTestRunner.waitForConsoleMessages(2, () => TestRunner.runTestSuite(testSuite));
ConsoleTestRunner.waitForConsoleMessages(2, async () => {
await ConsoleTestRunner.waitForPendingViewportUpdates();
TestRunner.runTestSuite(testSuite);
});
ConsoleTestRunner.evaluateInConsole(
'\'foo ' +
'\n'.repeat(50) + 'bar\'');
......
......@@ -418,7 +418,7 @@ Console.ConsoleView = class extends UI.VBox {
} else {
this._scheduleViewportRefreshForTest(false);
}
this._viewportThrottler.schedule(this._invalidateViewport.bind(this));
this._scheduledRefreshPromiseForTest = this._viewportThrottler.schedule(this._invalidateViewport.bind(this));
}
/**
......
......@@ -191,6 +191,11 @@ ConsoleTestRunner.addConsoleViewSniffer = function(override, opt_sticky) {
TestRunner.addSniffer(Console.ConsoleView.prototype, '_consoleMessageAddedForTest', override, opt_sticky);
};
ConsoleTestRunner.waitForPendingViewportUpdates = async function() {
var refreshPromise = Console.ConsoleView.instance()._scheduledRefreshPromiseForTest || Promise.resolve();
await refreshPromise;
};
/**
* @param {string} code
* @param {!Function=} callback
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment