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

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

Issue 1089523002: ScreenOrientationController: task-based dispatching of change events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
Index: LayoutTests/screen_orientation/page-visibility.html
diff --git a/LayoutTests/screen_orientation/page-visibility.html b/LayoutTests/screen_orientation/page-visibility.html
index 51d9708da10cead09c11f5fd76383eec679a6b92..73c19e4cf23e52428171d497c9b656c0fa7455a5 100644
--- a/LayoutTests/screen_orientation/page-visibility.html
+++ b/LayoutTests/screen_orientation/page-visibility.html
@@ -12,11 +12,16 @@ var orientationUnchangeHiddenTest = async_test("Test that screen.orientation kee
var orientationUpdateVisibleTest = async_test("Test that screen.orientation is updated once the page is visible again.");
var frameEventsTest = async_test("Test that the iframe got as many events as the main frame.");
+var orientationChangeContinuation = null;
var orientationChangeEventListenerCalls = 0;
var orientationChangeEventListenerCallsForFrame = 0;
screen.orientation.addEventListener('change', function() {
orientationChangeEventListenerCalls++;
+ if (orientationChangeEventContinuation) {
+ setTimeout(orientationChangeEventContinuation);
+ orientationChangeEventContinuation = null;
+ }
});
window.frames[0].screen.orientation.addEventListener('change', function() {
@@ -31,7 +36,7 @@ function runEventVisibleTest() {
if (window.testRunner)
window.testRunner.setMockScreenOrientation("landscape-primary");
- setTimeout(function() {
+ orientationChangeEventContinuation = function() {
eventVisibleTest.step(function() {
assert_equals(orientationChangeEventListenerCalls, 1);
assert_equals(screen.orientation.type, "landscape-primary");
@@ -39,7 +44,7 @@ function runEventVisibleTest() {
eventVisibleTest.done();
runNoEventHiddenTest();
- });
+ };
}
function runNoEventHiddenTest() {
@@ -53,14 +58,12 @@ function runNoEventHiddenTest() {
if (window.testRunner)
window.testRunner.setMockScreenOrientation("portrait-primary");
- setTimeout(function() {
- noEventHiddenTest.step(function() {
- assert_equals(orientationChangeEventListenerCalls, 1);
- });
- noEventHiddenTest.done();
-
- runOrientationUnchangeHiddenTest();
+ noEventHiddenTest.step(function() {
+ assert_equals(orientationChangeEventListenerCalls, 1);
});
+ noEventHiddenTest.done();
+
+ runOrientationUnchangeHiddenTest();
}
function runOrientationUnchangeHiddenTest() {
@@ -76,7 +79,7 @@ function runOrientationUpdateVisibleTest() {
if (window.testRunner)
testRunner.setPageVisibility("visible");
- setTimeout(function() {
+ orientationChangeEventContinuation = function() {
orientationUpdateVisibleTest.step(function() {
assert_false(document.hidden);
// A change event should have been fired.
@@ -88,7 +91,7 @@ function runOrientationUpdateVisibleTest() {
orientationUpdateVisibleTest.done();
runFrameEventsTest();
- });
+ };
}
function runFrameEventsTest() {

Powered by Google App Engine
This is Rietveld 408576698