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

Unified Diff: LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js

Issue 22599005: Blink-side layout tests for the new Device Orientation API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased once more Created 7 years, 3 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/fast/dom/DeviceOrientation/script-tests/null-values.js
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js
index 5693f136bf55262d79b6d203cced260e148a6e36..134b502141ff5e7980f9426bb50dc91844d7e60f 100644
--- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js
+++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js
@@ -1,13 +1,14 @@
description('Tests using null values for some of the event properties.');
var mockEvent;
-function setMockOrientation(alpha, beta, gamma) {
- mockEvent = {alpha: alpha, beta: beta, gamma: gamma};
+function setMockOrientation(alpha, beta, gamma, absolute) {
+ mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute};
if (window.testRunner)
testRunner.setMockDeviceOrientation(
null != mockEvent.alpha, null == mockEvent.alpha ? 0 : mockEvent.alpha,
null != mockEvent.beta, null == mockEvent.beta ? 0 : mockEvent.beta,
- null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gamma);
+ null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gamma,
+ null != mockEvent.absolute, null == mockEvent.absolute ? false : mockEvent.absolute);
else
debug('This test can not be run without the TestRunner');
}
@@ -18,29 +19,39 @@ function checkOrientation(event) {
shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha');
shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta');
shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma');
+ shouldBe('deviceOrientationEvent.absolute', 'mockEvent.absolute');
}
function firstListener(event) {
checkOrientation(event);
window.removeEventListener('deviceorientation', firstListener);
+ setTimeout(function(){initSecondListener();}, 0);
+}
- setMockOrientation(1.1, null, null);
+function initSecondListener() {
+ setMockOrientation(1.1, null, null, true);
window.addEventListener('deviceorientation', secondListener);
}
function secondListener(event) {
checkOrientation(event);
window.removeEventListener('deviceorientation', secondListener);
+ setTimeout(function(){initThirdListener();}, 0);
+}
- setMockOrientation(null, 2.2, null);
+function initThirdListener() {
+ setMockOrientation(null, 2.2, null, true);
window.addEventListener('deviceorientation', thirdListener);
}
function thirdListener(event) {
checkOrientation(event);
window.removeEventListener('deviceorientation', thirdListener);
+ setTimeout(function(){initFourthListener();}, 0);
+}
- setMockOrientation(null, null, 3.3);
+function initFourthListener() {
+ setMockOrientation(null, null, 3.3, true);
window.addEventListener('deviceorientation', fourthListener);
}
@@ -49,7 +60,7 @@ function fourthListener(event) {
finishJSTest();
}
-setMockOrientation(null, null, null);
+setMockOrientation(null, null, null, false);
window.addEventListener('deviceorientation', firstListener);
window.jsTestIsAsync = true;

Powered by Google App Engine
This is Rietveld 408576698