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

Unified Diff: LayoutTests/screen_orientation/orientationchange-event.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/orientationchange-event.html
diff --git a/LayoutTests/screen_orientation/orientationchange-event.html b/LayoutTests/screen_orientation/orientationchange-event.html
index 2e9d3bc9e54d9dccf7f425c6eb8f91792a2a3502..2d1d728f2f431a4fad54fb4890c94cd73f381950 100644
--- a/LayoutTests/screen_orientation/orientationchange-event.html
+++ b/LayoutTests/screen_orientation/orientationchange-event.html
@@ -21,12 +21,18 @@ var orientationChangeEventHandlerCalls = 0;
// Count the number of calls received from the listener set with screen.orientation.addEventListene().
var orientationChangeEventListenerCalls = 0;
+var orientationChangeContinuation = null;
+
function getNextIndex() {
return (currentIndex + 1) % orientations.length;
}
window.screen.orientation.onchange = function() {
orientationChangeEventHandlerCalls++;
+ if (orientationChangeEventContinuation) {
+ setTimeout(orientationChangeEventContinuation);
+ orientationChangeEventContinuation = null;
+ }
};
window.screen.orientation.addEventListener('change', function() {
@@ -36,15 +42,13 @@ window.screen.orientation.addEventListener('change', function() {
function runNoChangeTest() {
window.testRunner.setMockScreenOrientation(orientations[currentIndex]);
- setTimeout(function() {
- noChangeTest.step(function() {
- assert_equals(screen.orientation.type, orientations[currentIndex]);
- assert_equals(orientationChangeEventHandlerCalls, 4);
- assert_equals(orientationChangeEventListenerCalls, 4);
- });
-
- noChangeTest.done();
+ noChangeTest.step(function() {
+ assert_equals(screen.orientation.type, orientations[currentIndex]);
+ assert_equals(orientationChangeEventHandlerCalls, 4);
+ assert_equals(orientationChangeEventListenerCalls, 4);
});
+
+ noChangeTest.done();
}
var i = 0;
@@ -52,7 +56,7 @@ function runChangeTest() {
window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]);
currentIndex = getNextIndex();
- setTimeout(function() {
+ orientationChangeEventContinuation = function() {
changeTest.step(function() {
assert_equals(screen.orientation.type, orientations[currentIndex]);
assert_equals(orientationChangeEventHandlerCalls, i + 1);
@@ -66,7 +70,7 @@ function runChangeTest() {
} else {
runChangeTest();
}
- });
+ };
}
runChangeTest();

Powered by Google App Engine
This is Rietveld 408576698