gecko-dev/testing/web-platform/tests/idle-detection/idle-detection-default-feature-policy.https.sub.html
Sam Goto 6e3048d3bf Bug 1536014 [wpt PR 15829] - [idle] Port to the IdleDetector API, a=testonly
Automatic update from web-platform-tests
[idle] Port to the IdleDetector API

This is a minimal/incomplete/incremental port from the existing API
to the IdleDetector API under consideration.

https://github.com/w3ctag/design-reviews/issues/336#issuecomment-470077151

I'm trying to keep this baseline deliberately small, so we can introduce
the other parts of the API incrementally.

Change-Id: I4db6c67c561d397f1b027bc7c5524c5f8af17715
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1512681
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642648}

--

wpt-commits: 6e129aedfa10bbd9801fe25f8e401d251964afe2
wpt-pr: 15829
2019-04-24 11:18:43 +01:00

33 lines
1 KiB
HTML

<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<script>
'use strict';
const same_origin_src =
'/feature-policy/resources/feature-policy-idle-detection.html'
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
promise_test(async () => {
await new IdleDetector().start()
},
'Default "idle-detection" feature policy ["self"] ' +
'allows the top-level document.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_src,
expect_feature_available_default);
}, 'Default "idle-detection" feature policy ["self"] ' +
'allows same-origin iframes.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_src,
expect_feature_unavailable_default);
}, 'Default "idle-detection" feature policy ["self"] ' +
'disallows cross-origin iframes.');
</script>
</body>