Bug 1523562 [wpt PR 14827] - Feature Policy JS API Update: Add document.featurePolicy.features, a=testonly

Automatic update from web-platform-tests
Feature Policy JS API Update: Add document.featurePolicy.features

This adds a method to return the names of all policy-controlled
features supported by the browser. Because this list is determined by
the set of features implemented by Chrome, rather than conformance to
any particular spec, the tests are in /webexposed/ rather than WPT.

(Existing IDL tests in WPT cover the existence of the new method and
the data types that it returns, without depending on the exact values
returned.)

Bug: 917070
Change-Id: I35ccbdce794e236500d15afe5419057a8f162ae7
Reviewed-on: https://chromium-review.googlesource.com/c/1387151
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625667}

--

wpt-commits: f4c41eec30303b282c8107f35c788ffd125dd567
wpt-pr: 14827
This commit is contained in:
Ian Clelland 2019-01-31 19:00:47 +00:00 коммит произвёл James Graham
Родитель 0d6e01e472
Коммит 4e861a24b9
14 изменённых файлов: 158 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that accelerometer is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('accelerometer', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise accelerometer.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that ambient-light-sensor is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('ambient-light-sensor', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise ambient-light-sensor.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that encrypted-media is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://github.com/w3c/encrypted-media/pull/432">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('encrypted-media', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise encrypted-media.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that payment is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://github.com/w3c/payment-request/issues/600">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('payment', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise payment.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that picture-in-picture is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://wicg.github.io/picture-in-picture/#feature-policy">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('picture-in-picture', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise picture-in-picture.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that geolocation is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('geolocation', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise geolocation.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that gyroscope is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('gyroscope', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise gyroscope.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that autoplay is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#policy-controlled-features">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('autoplay', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise autoplay.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that magnetometer is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('magnetometer', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise magnetometer.');
</script>

Просмотреть файл

@ -0,0 +1,15 @@
<!DOCTYPE html>
<title>Test that accelerometer is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/mediacapture-main/#feature-policy-integration">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('camera', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise camera.');
test(() => {
assert_in_array('microphone', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise microphone.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that wake-lock is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://w3c.github.io/wake-lock/#dfn-wake-lock-feature">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('wake-lock', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise wake-lock.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that usb is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://wicg.github.io/webusb/#feature-policy">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('usb', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise usb.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that xr is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://immersive-web.github.io/webxr/#feature-policy">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('xr', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise xr.');
</script>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Test that sync-xhr is advertised in the feature list</title>
<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features">
<link rel="help" href="https://xhr.spec.whatwg.org/#feature-policy-integration">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_in_array('sync-xhr', document.featurePolicy.features());
}, 'document.featurePolicy.features should advertise sync-xhr.');
</script>