Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: LayoutTests/gamepad/page-visibility.html

Issue 872373002: Fix gamepad/page-visibility.html flakiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/gamepad/page-visibility.html
diff --git a/LayoutTests/gamepad/page-visibility.html b/LayoutTests/gamepad/page-visibility.html
index bc3c69375bfa8856406947110f3e287485006a4b..6cce422375abd7fd13bd60cff103ded4fca53fc8 100644
--- a/LayoutTests/gamepad/page-visibility.html
+++ b/LayoutTests/gamepad/page-visibility.html
@@ -42,6 +42,10 @@ var expectations = [
];
var expected;
+function allTestsCompleted() {
+ return eventCounter == expectations.length;
+}
+
function testWithPageVisibleAgain() {
shouldBeEqualToString('document.visibilityState', 'hidden');
removeListeners();
@@ -55,7 +59,7 @@ function testWithPageVisibleAgain() {
if (expected.check)
expected.check(event);
- if (eventCounter == expectations.length)
+ if (allTestsCompleted())
finishSoon(); // Give some time to fail if unexpecteds events are coming.
});
window.addEventListener('gamepaddisconnected', function(event) {
@@ -67,16 +71,11 @@ function testWithPageVisibleAgain() {
if (expected.check)
expected.check(event);
- if (eventCounter == expectations.length)
+ if (allTestsCompleted())
finishSoon(); // Give some time to fail if unexpecteds events are coming.
});
testRunner.setPageVisibility('visible');
-
- setTimeout(function() {
- testFailed('More gamepad events should have been received');
- finishJSTest();
- }, 100);
}
function testWithPageHidden() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698