Commit 1ece1405 authored by Wanming Lin's avatar Wanming Lin Committed by Commit Bot

[device-orientation] Remove duplicated tests

This CL removes duplicated tests in wpt and moves
uncovered checkpoints from those duplicated tests
to existing tests.

Tests in device-orientation-on-secure-origin.https.html
are covered in several existing tests.

devicemotionevent-init.https.html
duplicates with motion/optional-event-properties.https.html

deviceorientationevent-init.https.html
duplicates with orientation/optional-event-properties.https.html

motion/add-child-listener.https.html duplicates with
device-orientation-events-of-detached-documents.https.html

orientation/window-property.https.html, motion/window-property.https.html
duplicate with idlharness.https.window.js

t001-manual.https.html, t002-manual.https.html, t003-manual.https.html
duplicate with orientation/add-listener-from-callback.https.html

t021-manual.https.html, t022-manual.https.html, t023-manual.https.html
duplicate with motion/add-listener-from-callback.https.html

ondeviceorientationabsolute.https.html duplicates with
orientation/deviceorientationabsoluteevent.https.html

Bug: 816462
Change-Id: Ic1f604e144a6a853c989f1596873d079247f21f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147359Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Wanming Lin <wanming.lin@intel.com>
Cr-Commit-Position: refs/heads/master@{#759138}
parent 040e9f02
...@@ -1819,16 +1819,10 @@ external/wpt/orientation-event/orientation/page-visibility-manual.https.html [ S ...@@ -1819,16 +1819,10 @@ external/wpt/orientation-event/orientation/page-visibility-manual.https.html [ S
external/wpt/orientation-event/free-fall-manual.https.html [ Skip ] external/wpt/orientation-event/free-fall-manual.https.html [ Skip ]
external/wpt/orientation-event/screen-upmost-manual.https.html [ Skip ] external/wpt/orientation-event/screen-upmost-manual.https.html [ Skip ]
external/wpt/orientation-event/screen-upright-manual.https.html [ Skip ] external/wpt/orientation-event/screen-upright-manual.https.html [ Skip ]
external/wpt/orientation-event/t001-manual.https.html [ Skip ]
external/wpt/orientation-event/t002-manual.https.html [ Skip ]
external/wpt/orientation-event/t003-manual.https.html [ Skip ]
external/wpt/orientation-event/t006-manual.https.html [ Skip ] external/wpt/orientation-event/t006-manual.https.html [ Skip ]
external/wpt/orientation-event/t009-manual.https.html [ Skip ] external/wpt/orientation-event/t009-manual.https.html [ Skip ]
external/wpt/orientation-event/t010-manual.https.html [ Skip ] external/wpt/orientation-event/t010-manual.https.html [ Skip ]
external/wpt/orientation-event/t012-manual.https.html [ Skip ] external/wpt/orientation-event/t012-manual.https.html [ Skip ]
external/wpt/orientation-event/t021-manual.https.html [ Skip ]
external/wpt/orientation-event/t022-manual.https.html [ Skip ]
external/wpt/orientation-event/t023-manual.https.html [ Skip ]
external/wpt/orientation-event/t025-manual.https.html [ Skip ] external/wpt/orientation-event/t025-manual.https.html [ Skip ]
external/wpt/orientation-event/t028-manual.https.html [ Skip ] external/wpt/orientation-event/t028-manual.https.html [ Skip ]
external/wpt/page-visibility/test_minimize-manual.html [ Skip ] external/wpt/page-visibility/test_minimize-manual.html [ Skip ]
......
...@@ -271,7 +271,7 @@ external/wpt/navigation-timing/nav2_test_instance_accessible_from_the_start.html ...@@ -271,7 +271,7 @@ external/wpt/navigation-timing/nav2_test_instance_accessible_from_the_start.html
external/wpt/navigation-timing/test_navigation_redirectCount_none.html external/wpt/navigation-timing/test_navigation_redirectCount_none.html
external/wpt/orientation-event/motion/add-listener-from-callback.https.html external/wpt/orientation-event/motion/add-listener-from-callback.https.html
external/wpt/orientation-event/orientation/create-event.https.html external/wpt/orientation-event/orientation/create-event.https.html
external/wpt/orientation-event/devicemotionevent-init.https.html external/wpt/orientation-event/motion/optional-event-properties.https.html
external/wpt/pointerevents/pointerevent_touch-action-illegal.html external/wpt/pointerevents/pointerevent_touch-action-illegal.html
external/wpt/preload/avoid-delaying-onload-link-preload.html external/wpt/preload/avoid-delaying-onload-link-preload.html
external/wpt/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html external/wpt/referrer-policy/generic/subresource-test/attr-referrer-invalid-value.html
......
<!DOCTYPE html>
<title>Device Sensor Events on Secure Origin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/orientation-event-helpers.js"></script>
<script>
test(() => {
assert_true('ondevicemotion' in window);
assert_true('ondeviceorientation' in window);
assert_true('DeviceMotionEvent' in window);
assert_true('DeviceOrientationEvent' in window);
assert_true('DeviceMotionEventAcceleration' in window);
assert_true('DeviceMotionEventRotationRate' in window);
}, 'Event handlers as well as interfaces are exposed on `window`.');
sensor_test(async (t, sensorProvider) => {
const FAKE_ACCELERATION_DATA = [1, 2, 3];
const FAKE_LINEAR_ACCELERATION_DATA = [4, 5, 6];
const FAKE_GYROSCOPE_DATA = [7, 8, 9];
setMockSensorDataForType(sensorProvider, 'Accelerometer', FAKE_ACCELERATION_DATA);
setMockSensorDataForType(sensorProvider, 'LinearAccelerationSensor', FAKE_LINEAR_ACCELERATION_DATA);
setMockSensorDataForType(sensorProvider, 'Gyroscope', FAKE_GYROSCOPE_DATA);
const radToDeg = 180 / Math.PI;
return waitForEvent(new DeviceMotionEvent('devicemotion', {
acceleration: {
x: FAKE_LINEAR_ACCELERATION_DATA[0],
y: FAKE_LINEAR_ACCELERATION_DATA[1],
z: FAKE_LINEAR_ACCELERATION_DATA[2],
},
accelerationIncludingGravity: {
x: FAKE_ACCELERATION_DATA[0],
y: FAKE_ACCELERATION_DATA[1],
z: FAKE_ACCELERATION_DATA[2],
},
rotationRate: {
alpha: FAKE_GYROSCOPE_DATA[0] * radToDeg,
beta: FAKE_GYROSCOPE_DATA[1] * radToDeg,
gamma: FAKE_GYROSCOPE_DATA[2] * radToDeg,
},
interval: 16,
}));
}, 'DeviceMotionEvent fires.');
sensor_test(async (t, sensorProvider) => {
const FAKE_ORIENTATION_DATA = [1.1, 2.2, 3.3];
setMockSensorDataForType(sensorProvider, 'RelativeOrientationEulerAngles', FAKE_ORIENTATION_DATA);
return waitForEvent(new DeviceOrientationEvent('deviceorientation', {
alpha: FAKE_ORIENTATION_DATA[2],
beta: FAKE_ORIENTATION_DATA[0],
gamma: FAKE_ORIENTATION_DATA[1],
absolute: false,
}));
}, 'DeviceOrientationEvent fires.');
sensor_test(async (t, sensorProvider) => {
const FAKE_ORIENTATION_DATA = [1.1, 2.2, 3.3];
setMockSensorDataForType(sensorProvider, 'AbsoluteOrientationEulerAngles', FAKE_ORIENTATION_DATA);
return waitForEvent(new DeviceOrientationEvent('deviceorientationabsolute', {
alpha: FAKE_ORIENTATION_DATA[2],
beta: FAKE_ORIENTATION_DATA[0],
gamma: FAKE_ORIENTATION_DATA[1],
absolute: true,
}));
}, 'DeviceOrientationEvent fires (with absolute orientation).');
</script>
<!DOCTYPE html>
<html>
<head>
<title>DeviceMotionEvent attributes must be initialized properly</title>
<meta charset='utf-8'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>DeviceOrientationEvent attributes must be initialized properly.</p>
<div id="log"></div>
<script>
test(function() {
var evt = new DeviceMotionEvent("foo");
assert_equals(evt.type, "foo", "type is set to \"foo\"");
assert_equals(evt.acceleration, null,
"acceleration must be initialized to null");
assert_equals(evt.accelerationIncludingGravity, null,
"accelerationIncludingGravity must be initialized to null");
assert_equals(evt.rotationRate, null,
"rotationRate must be initialized to null");
assert_equals(evt.interval, 0, "interval must be initialized to 0");
}, "User created event is initialized properly with default values");
test(function() {
var evt = new DeviceMotionEvent("foo", {
acceleration: { x: 56, y: -56, z: 64 },
accelerationIncludingGravity: { x: 56, y: -56, z: 64 },
rotationRate: { alpha: 56, beta: -56, gamma: 64 },
interval: 3
});
assert_equals(evt.type, "foo", "type is set to \"foo\"");
assert_equals(typeof evt.acceleration, "object", "acceleration is an object");
assert_equals(evt.acceleration.x, 56, "acceleration.x is set to 56");
assert_equals(evt.acceleration.y, -56, "acceleration.y is set to -56");
assert_equals(evt.acceleration.z, 64, "acceleration.z is set to 64");
assert_equals(typeof evt.accelerationIncludingGravity, "object", "accelerationIncludingGravity is an object");
assert_equals(evt.accelerationIncludingGravity.x, 56, "accelerationIncludingGravity.x is set to 56");
assert_equals(evt.accelerationIncludingGravity.y, -56, "accelerationIncludingGravity.y is set to -56");
assert_equals(evt.accelerationIncludingGravity.z, 64, "accelerationIncludingGravity.z is set to 64");
assert_equals(typeof evt.rotationRate, "object", "rotationRate is an object");
assert_equals(evt.rotationRate.alpha, 56, "rotationRate.alpha is set to 56");
assert_equals(evt.rotationRate.beta, -56, "rotationRate.beta is set to -56");
assert_equals(evt.rotationRate.gamma, 64, "rotationRate.gamma is set to 64");
assert_equals(evt.interval, 3, "interval is set to 3");
}, "User created event is initialized properly using dictionary");
</script>
</body>
</html>
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
if (!run) { if (!run) {
run = true; run = true;
t.step(function () { t.step(function () {
assert_true(e instanceof DeviceOrientationEvent, "instanceof DeviceOrientationEvent");
assert_equals(e.type, "deviceorientationabsolute", "type is set to \"deviceorientationabsolute\""); assert_equals(e.type, "deviceorientationabsolute", "type is set to \"deviceorientationabsolute\"");
assert_equals(e.alpha, null, "alpha is set to null"); assert_equals(e.alpha, null, "alpha is set to null");
assert_equals(e.beta, null, "beta is set to null"); assert_equals(e.beta, null, "beta is set to null");
......
<!DOCTYPE html>
<html>
<head>
<title>DeviceOrientationEvent attributes must be initialized properly</title>
<meta charset='utf-8'>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>DeviceOrientationEvent attributes must be initialized properly.</p>
<div id="log"></div>
<script>
test(function() {
var evt = new DeviceOrientationEvent("foo");
assert_equals(evt.type, "foo", "type is set to \"foo\"");
assert_equals(evt.alpha, null, "alpha is set to null");
assert_equals(evt.beta, null, "beta is set to null");
assert_equals(evt.gamma, null, "gamma is set to null");
assert_false(evt.absolute, "absolute is set to false");
}, "User created event is initialized properly with default values");
test(function() {
var evt = new DeviceOrientationEvent("foo", {
alpha: 56,
beta: -56,
gamma: 64,
absolute: true
});
assert_equals(evt.type, "foo", "type is set to \"foo\"");
assert_equals(evt.alpha, 56, "alpha is set to 56");
assert_equals(evt.beta, -56, "beta is set to -56");
assert_equals(evt.gamma, 64, "gamma is set to 64");
assert_true(evt.absolute, "absolute is set to true");
}, "User created event is initialized properly using a dictionary");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
test(() => {
const childFrame = document.createElement('iframe');
document.body.appendChild(childFrame);
const childWindow = childFrame.contentWindow;
document.body.removeChild(childFrame);
childWindow.addEventListener('devicemotion', () => {});
}, 'Tests that an event listener can be safely added to a child frame that has been detached from the parent.');
</script>
</body>
</html>
...@@ -17,6 +17,9 @@ sensor_test(async (t, sensorProvider) => { ...@@ -17,6 +17,9 @@ sensor_test(async (t, sensorProvider) => {
let firstEventCount = 0; let firstEventCount = 0;
let firstPromise = new Promise(resolve => { let firstPromise = new Promise(resolve => {
firstListener = (event) => { firstListener = (event) => {
assert_true(event instanceof DeviceMotionEvent, 'event is DeviceMotionEvent');
assert_equals(event.type, 'devicemotion', 'event.type is devicemotion');
assert_true(event.target instanceof Window, 'event is fired on the window object');
checkMotion(event, motionData); checkMotion(event, motionData);
window.removeEventListener('devicemotion', firstListener); window.removeEventListener('devicemotion', firstListener);
if (++firstEventCount == 1) { if (++firstEventCount == 1) {
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
function hasDeviceMotionEventProperty()
{
for (let property in window) {
if (property == "DeviceMotionEvent")
return true;
}
return false;
}
function hasOnDeviceMotionProperty()
{
for (let property in window) {
if (property == "ondevicemotion")
return true;
}
return false;
}
test(test => {
assert_equals(typeof window.DeviceMotionEvent, 'function');
assert_false(hasDeviceMotionEventProperty());
assert_true('DeviceMotionEvent' in window);
assert_true(window.hasOwnProperty('DeviceMotionEvent'));
assert_equals(typeof window.ondevicemotion, 'object');
assert_true(hasOnDeviceMotionProperty());
assert_true('ondevicemotion' in window);
assert_true(window.hasOwnProperty('ondevicemotion'));
}, 'Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present.');
</script>
<!DOCTYPE html>
<html>
<head>
<title>User agents must also provide an event handler IDL attribute named ondeviceorientationabsolute on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<p>Rotate the device to run the tests.</p>
<div id="log"></div>
<script>
var t1 = async_test("Provide an event handler IDL attribute named ondeviceorientationabsolute");
var t2 = async_test("The type of this event handler must be 'DeviceOrientationEvent'");
var t3 = async_test("The absolute property must be set to true.");
var run = false;
if (window.ondeviceorientationabsolute === undefined) {
t1.step(t1.unreached_func("ondeviceorientationabsolute not supported"));
t2.step(t2.unreached_func("ondeviceorientationabsolute not supported"));
t3.step(t3.unreached_func("ondeviceorientationabsolute not supported"));
} else {
window.ondeviceorientationabsolute = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "deviceorientationabsolute");
});
t1.done();
t2.step(function() {
assert_true(e instanceof DeviceOrientationEvent);
});
t2.done();
t3.step(function() {
assert_true(e.absolute);
});
t3.done();
}
};
}
</script>
</body>
</html>
...@@ -15,6 +15,9 @@ sensor_test(async (t, sensorProvider) => { ...@@ -15,6 +15,9 @@ sensor_test(async (t, sensorProvider) => {
let firstEventCount = 0; let firstEventCount = 0;
let firstPromise = new Promise(resolve => { let firstPromise = new Promise(resolve => {
firstListener = (event) => { firstListener = (event) => {
assert_true(event instanceof DeviceOrientationEvent, 'event is DeviceOrientationEvent');
assert_equals(event.type, 'deviceorientation', 'event.type is devicemotion');
assert_true(event.target instanceof Window, 'event is fired on the window object');
checkOrientation(event, orientationData); checkOrientation(event, orientationData);
window.removeEventListener('deviceorientation', firstListener); window.removeEventListener('deviceorientation', firstListener);
if (++firstEventCount == 1) { if (++firstEventCount == 1) {
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
function hasProperty(orientationProperty)
{
for (let property in window) {
if (property == orientationProperty)
return true;
}
return false;
}
test(test => {
assert_equals(typeof window.DeviceOrientationEvent, 'function');
assert_false(window.propertyIsEnumerable('DeviceOrientationEvent'));
assert_true('DeviceOrientationEvent' in window);
assert_true(window.hasOwnProperty('DeviceOrientationEvent'));
assert_equals(typeof window.ondeviceorientation, 'object');
assert_equals(typeof window.ondeviceorientationabsolute, 'object');
assert_true(hasProperty('ondeviceorientation'));
assert_true(hasProperty('ondeviceorientationabsolute'));
assert_true('ondeviceorientation' in window);
assert_true('ondeviceorientationabsolute' in window);
assert_true(window.hasOwnProperty('ondeviceorientation'));
assert_true(window.hasOwnProperty('ondeviceorientationabsolute'));
}, 'Tests that the window.DeviceOrientationEvent and window.ondeviceorientation and window.ondeviceorientationabsolute properties are present.');
</script>
<!DOCTYPE html>
<html>
<head>
<title>User agents implementing this specification must provide a new DOM event, named deviceorientation</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the test.</p>
<div id="log"></div>
<script>
var t = async_test("deviceorientation event fires");
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
t.done();
}
}, false);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object.</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the tests.</p>
<div id="log"></div>
<script>
var t1 = async_test("The corresponding event must be of type DeviceOrientationEvent");
var t2 = async_test("The corresponding event must fire on the window object");
var run = false;
window.addEventListener("deviceorientation", function(e) {
if (!run) {
run = true;
var _this = this;
t1.step(function() {
assert_equals(e.type, "deviceorientation");
});
t1.done();
t2.step(function() {
assert_equals(_this, window);
});
t2.done();
}
}, false);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>User agents must also provide an event handler IDL attribute [HTML5] named ondeviceorientation on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-12 -->
</head>
<body>
<p>Rotate the device to run the tests.</p>
<div id="log"></div>
<script>
var t1 = async_test("Provide an event handler IDL attribute [HTML5] named ondeviceorientation");
var t2 = async_test("The type of this event handler must be 'DeviceOrientationEvent'");
var run = false;
window.ondeviceorientation = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "deviceorientation");
});
t1.done();
t2.step(function() {
assert_true(e instanceof "DeviceOrientationEvent");
});
t2.done();
}
};
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>User agents implementing this specification must provide a new DOM event, named devicemotion</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t = async_test("devicemotion event exists");
var run = false;
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t.done();
}
}, false);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>The corresponding event must be of type DeviceOrientationEvent and must fire on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t1 = async_test("The corresponding event must be of type DeviceMotionEvent");
var t2 = async_test("The corresponding event must fire on the window object");
var run = false;
window.addEventListener("devicemotion", function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "devicemotion");
});
t1.done();
t2.step(function() {
assert_true(e.target instanceof Window);
});
t2.done();
}
}, false);
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>User agents must also provide an event handler IDL attribute HTML5 named ondevicemotion on the window object</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="author" title="Mosquito FP7">
<link rel="reviewer author" title="Zhiqiang Zhang" href="mailto:zhiqiang.zhang@intel.com"> <!-- 2013-10-14 -->
</head>
<body>
<p>Move the device to run the test.</p>
<div id="log"></div>
<script>
var t1 = async_test("User agents provide an event handler IDL attribute HTML5 named ondevicemotion");
var t2 = async_test("The type of this event handler must be 'DeviceMotionEvent'");
var run = false;
window.ondevicemotion = function(e) {
if (!run) {
run = true;
t1.step(function() {
assert_equals(e.type, "devicemotion");
});
t1.done();
t2.step(function() {
assert_true(e instanceof "DeviceMotionEvent");
});
t2.done();
}
};
</script>
</body>
</html>
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