gecko-dev/testing/web-platform/tests/orientation-event/deviceorientationevent-init.https.html
Balazs Engedy 93aa4bc4ff Bug 1529080 [wpt PR 15398] - Restrict Device{Orientation|Motion}Events to secure origins., a=testonly
Automatic update from web-platform-tests
Restrict Device{Orientation|Motion}Events to secure origins.

Registering event handlers to `devicemotion`, `deviceorientation`,
and `deviceorientationabsolute` events is still possible, but the
handlers will never be invoked in non-secure browsing contexts.

The following, related, interfaces are marked as [SecureContext]:
  -- DeviceOrientationEvent,
  -- DeviceMotionEvent,
  -- DeviceMotionEventAcceleration,
  -- DeviceMotionEventRotationRate.

The change is gated on RestrictDeviceSensorEventsToSecureContexts,
which is disabled by default, so this CL is a no-op unless the
base::Feature with the same name is manually enabled.

Intent to remove: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/5yqfAXibz1I

Bug: 932078
Change-Id: I9baaafd1f4483f121feadc054650c4d510a2c88d
TBR: haraken@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/1473992
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634620}

--

wpt-commits: c401bb4fdb48c7536a96d25570242444f1b6b5f0
wpt-pr: 15398


--HG--
rename : testing/web-platform/tests/orientation-event/devicemotionevent-init.html => testing/web-platform/tests/orientation-event/devicemotionevent-init.https.html
rename : testing/web-platform/tests/orientation-event/deviceorientationabsoluteevent.html => testing/web-platform/tests/orientation-event/deviceorientationabsoluteevent.https.html
rename : testing/web-platform/tests/orientation-event/deviceorientationevent-init.html => testing/web-platform/tests/orientation-event/deviceorientationevent-init.https.html
rename : testing/web-platform/tests/orientation-event/ondeviceorientationabsolute.html => testing/web-platform/tests/orientation-event/ondeviceorientationabsolute.https.html
2019-03-16 12:13:23 +00:00

37 lines
1.4 KiB
HTML

<!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>