idle-detection: Feature-Policy is now Permissions-Policy
This change replaces web-platform-tests/wpt#37110, renaming all of the
Feature Policy tests to Permissions Policy tests and using the
infrastructure from /permissions-policy instead.
Change-Id: I26c4619edd3aa12888fb4cef0aa371f0e14ffad4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4052880
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/main@{#1075304}
diff --git a/feature-policy/resources/feature-policy-idle-detection-worker.html b/feature-policy/resources/feature-policy-idle-detection-worker.html
deleted file mode 100644
index 1ef5298..0000000
--- a/feature-policy/resources/feature-policy-idle-detection-worker.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<script>
-'use strict';
-
-let worker = new Worker('feature-policy-idle-detection-worker.js');
-
-worker.onmessage = event => {
- window.parent.postMessage(event.data, '*');
-};
-worker.postMessage({ type: 'ready' });
-</script>
diff --git a/feature-policy/resources/feature-policy-idle-detection-worker.js b/feature-policy/resources/feature-policy-idle-detection-worker.js
deleted file mode 100644
index 2e4e3cd..0000000
--- a/feature-policy/resources/feature-policy-idle-detection-worker.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-// Dedicated worker
-if (typeof postMessage === 'function') {
- onmessage = event => {
- switch(event.data.type) {
- case 'ready':
- new IdleDetector().start().then(() => {
- postMessage({ enabled: true });
- }, error => {
- postMessage ({ enabled: false });
- });
- break;
- }
- };
-}
diff --git a/feature-policy/resources/feature-policy-idle-detection.html b/feature-policy/resources/feature-policy-idle-detection.html
deleted file mode 100644
index 65a5781..0000000
--- a/feature-policy/resources/feature-policy-idle-detection.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<script>
-'use strict';
-
-new IdleDetector().start().then(() => {
- window.parent.postMessage({ enabled: true }, '*');
-}, error => {
- window.parent.postMessage({ enabled: false }, '*');
-});
-
-</script>
diff --git a/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html.headers b/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html.headers
deleted file mode 100644
index 729e942..0000000
--- a/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html.headers
+++ /dev/null
@@ -1 +0,0 @@
-Feature-Policy: idle-detection *
diff --git a/idle-detection/idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
similarity index 86%
rename from idle-detection/idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
rename to idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
index 6c6ff6f..fc92a09 100644
--- a/idle-detection/idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
+++ b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute-redirect-on-load.https.sub.html
@@ -4,16 +4,16 @@
<script src=/resources/testdriver-vendor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
-<script src=/feature-policy/resources/featurepolicy.js></script>
+<script src=/permissions-policy/resources/permissions-policy.js></script>
<script>
'use strict';
-const base_src = '/feature-policy/resources/redirect-on-load.html#';
+const base_src = '/permissions-policy/resources/redirect-on-load.html#';
const sub = 'https://{{domains[www]}}:{{ports[https][0]}}';
const relative_path =
- '/feature-policy/resources/feature-policy-idle-detection.html';
+ '/permissions-policy/resources/permissions-policy-idle-detection.html';
const relative_worker_frame_path =
- '/feature-policy/resources/feature-policy-idle-detection-worker.html';
+ '/permissions-policy/resources/permissions-policy-idle-detection-worker.html';
const same_origin_src = base_src + relative_path;
const same_origin_worker_frame_src = base_src + relative_worker_frame_path;
const cross_origin_src = base_src + sub + relative_path;
diff --git a/idle-detection/idle-detection-allowed-by-feature-policy-attribute.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html
similarity index 74%
rename from idle-detection/idle-detection-allowed-by-feature-policy-attribute.https.sub.html
rename to idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html
index f3cfa0e..be2de1d 100644
--- a/idle-detection/idle-detection-allowed-by-feature-policy-attribute.https.sub.html
+++ b/idle-detection/idle-detection-allowed-by-permissions-policy-attribute.https.sub.html
@@ -4,15 +4,15 @@
<script src=/resources/testdriver-vendor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
-<script src=/feature-policy/resources/featurepolicy.js></script>
+<script src=/permissions-policy/resources/permissions-policy.js></script>
<script>
'use strict';
const sub = 'https://{{domains[www]}}:{{ports[https][0]}}';
const same_origin_src =
- '/feature-policy/resources/feature-policy-idle-detection.html'
+ '/permissions-policy/resources/permissions-policy-idle-detection.html'
const same_origin_worker_frame_src =
- '/feature-policy/resources/feature-policy-idle-detection-worker.html';
+ '/permissions-policy/resources/permissions-policy-idle-detection-worker.html';
const cross_origin_src = sub + same_origin_src;
const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src;
@@ -24,25 +24,25 @@
test_feature_availability('new IdleDetector().start()', t, same_origin_src,
expect_feature_available_default, 'idle-detection');
}, 'Attribute allow="idle-detection" in top-level frame can be enabled ' +
- 'in same-origin iframe using Feature policy "idle-detection".');
+ 'in same-origin iframe using Permissions Policy "idle-detection".');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_worker_frame_src,
expect_feature_available_default, 'idle-detection');
}, 'Attribute allow="idle-detection" in top-level frame can be enabled ' +
- 'in a worker in same-origin iframe using Feature policy "idle-detection".');
+ 'in a worker in same-origin iframe using Permissions Policy "idle-detection".');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_src,
expect_feature_available_default, 'idle-detection');
}, 'Attribute allow="idle-detection" in top-level frame can be enabled ' +
- 'in cross-origin iframe using Feature policy "idle-detection".');
+ 'in cross-origin iframe using Permissions Policy "idle-detection".');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_worker_frame_src,
expect_feature_available_default, 'idle-detection');
}, 'Attribute allow="idle-detection" in top-level frame can be enabled ' +
- 'in a worker in cross-origin iframe using Feature policy "idle-detection".');
+ 'in a worker in cross-origin iframe using Permissions Policy "idle-detection".');
</script>
</body>
diff --git a/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html
similarity index 70%
rename from idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html
rename to idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html
index 75d1540..47a7d69 100644
--- a/idle-detection/idle-detection-allowed-by-feature-policy.https.sub.html
+++ b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html
@@ -4,15 +4,15 @@
<script src=/resources/testdriver-vendor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
-<script src=/feature-policy/resources/featurepolicy.js></script>
+<script src=/permissions-policy/resources/permissions-policy.js></script>
<script>
'use strict';
const sub = 'https://{{domains[www]}}:{{ports[https][0]}}';
const same_origin_src =
- '/feature-policy/resources/feature-policy-idle-detection.html'
+ '/permissions-policy/resources/permissions-policy-idle-detection.html'
const same_origin_worker_frame_src =
- '/feature-policy/resources/feature-policy-idle-detection-worker.html';
+ '/permissions-policy/resources/permissions-policy-idle-detection-worker.html';
const cross_origin_src = sub + same_origin_src;
const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src;
@@ -23,35 +23,35 @@
promise_test(async t => {
await new IdleDetector().start();
},
- 'Feature-Policy {"idle-detection" : ["*"]} explicity set by top-level ' +
+ 'Permissions-Policy idle-detection=* explicity set by top-level ' +
'frame allows the top-level document.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_src,
expect_feature_available_default);
-}, 'Feature-Policy {"idle-detection" : ["*"]} explicity set by top-level ' +
+}, 'Permissions-Policy idle-detection=* explicity set by top-level ' +
'frame allows same-origin iframes.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_worker_frame_src,
expect_feature_available_default);
-}, 'Feature-Policy {"idle-detection" : ["*"]} explicity set by top-level ' +
+}, 'Permissions-Policy idle-detection=* explicity set by top-level ' +
'frame allows workers in same-origin iframes.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_src,
expect_feature_available_default);
-}, 'Feature-Policy {"idle-detection" : ["*"]} explicity set by top-level ' +
+}, 'Permissions-Policy idle-detection=* explicity set by top-level ' +
'frame allows cross-origin iframes.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_worker_frame_src,
expect_feature_available_default);
-}, 'Feature-Policy {"idle-detection" : ["*"]} explicity set by top-level ' +
+}, 'Permissions-Policy idle-detection=* explicity set by top-level ' +
'frame allows workers in cross-origin iframes.');
fetch_tests_from_worker(new Worker(
- 'resources/idle-detection-allowed-by-feature-policy-worker.js'))
+ 'resources/idle-detection-allowed-by-permissions-policy-worker.js'))
</script>
</body>
diff --git a/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html.headers b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html.headers
new file mode 100644
index 0000000..2bf18af
--- /dev/null
+++ b/idle-detection/idle-detection-allowed-by-permissions-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Permissions-Policy: idle-detection=*
diff --git a/idle-detection/idle-detection-default-feature-policy.https.sub.html b/idle-detection/idle-detection-default-permissions-policy.https.sub.html
similarity index 74%
rename from idle-detection/idle-detection-default-feature-policy.https.sub.html
rename to idle-detection/idle-detection-default-permissions-policy.https.sub.html
index f0766ae..762e299 100644
--- a/idle-detection/idle-detection-default-feature-policy.https.sub.html
+++ b/idle-detection/idle-detection-default-permissions-policy.https.sub.html
@@ -4,12 +4,12 @@
<script src=/resources/testdriver-vendor.js></script>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
-<script src=/feature-policy/resources/featurepolicy.js></script>
+<script src=/permissions-policy/resources/permissions-policy.js></script>
<script>
'use strict';
const same_origin_src =
- '/feature-policy/resources/feature-policy-idle-detection.html'
+ '/permissions-policy/resources/permissions-policy-idle-detection.html'
const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
same_origin_src;
@@ -20,19 +20,19 @@
promise_test(async t => {
await new IdleDetector().start()
},
- 'Default "idle-detection" feature policy ["self"] ' +
+ 'Default "idle-detection" permissions policy "self" ' +
'allows the top-level document.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_src,
expect_feature_available_default);
-}, 'Default "idle-detection" feature policy ["self"] ' +
+}, 'Default "idle-detection" permissions policy "self" ' +
'allows same-origin iframes.');
promise_test(async t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_src,
expect_feature_unavailable_default);
-}, 'Default "idle-detection" feature policy ["self"] ' +
+}, 'Default "idle-detection" permissions policy "self" ' +
'disallows cross-origin iframes.');
</script>
diff --git a/idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html.headers b/idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html.headers
deleted file mode 100644
index f27e1a2..0000000
--- a/idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html.headers
+++ /dev/null
@@ -1 +0,0 @@
-Feature-Policy: idle-detection 'none'
diff --git a/idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html b/idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html
similarity index 68%
rename from idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html
rename to idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html
index 2814a22..90317de 100644
--- a/idle-detection/idle-detection-disabled-by-feature-policy.https.sub.html
+++ b/idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html
@@ -2,15 +2,15 @@
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
-<script src=/feature-policy/resources/featurepolicy.js></script>
+<script src=/permissions-policy/resources/permissions-policy.js></script>
<script>
'use strict';
const sub = 'https://{{domains[www]}}:{{ports[https][0]}}';
const same_origin_src =
- '/feature-policy/resources/feature-policy-idle-detection.html'
+ '/permissions-policy/resources/permissions-policy-idle-detection.html'
const same_origin_worker_frame_src =
- '/feature-policy/resources/feature-policy-idle-detection-worker.html';
+ '/permissions-policy/resources/permissions-policy-idle-detection-worker.html';
const cross_origin_src = sub + same_origin_src;
const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src;
@@ -22,35 +22,35 @@
} catch (error) {
assert_equals(error.name, 'SecurityError');
}
-}, 'Feature-Policy {"idle-detection" : []} explicitly set by top-level frame ' +
+}, 'Permissions-Policy idle-detection=() explicitly set by top-level frame ' +
'disallows query in the top-level document.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_src,
expect_feature_unavailable_default);
-}, 'Feature-Policy {"idle-detection" : []} explicitly set by top-level frame ' +
+}, 'Permissions-Policy idle-detection=() explicitly set by top-level frame ' +
'disallows same-origin iframes.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, same_origin_worker_frame_src,
expect_feature_unavailable_default);
-}, 'Feature-Policy {"idle-detection" : []} explicitly set by top-level frame ' +
+}, 'Permissions-Policy idle-detection=() explicitly set by top-level frame ' +
'disallows workers in same-origin iframes.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_src,
expect_feature_unavailable_default);
-}, 'Feature-Policy {"idle-detection" : []} explicitly set by top-level frame ' +
+}, 'Permissions-Policy idle-detection=() explicitly set by top-level frame ' +
'disallows cross-origin iframes.');
async_test(t => {
test_feature_availability('new IdleDetector().start()', t, cross_origin_worker_frame_src,
expect_feature_unavailable_default);
-}, 'Feature-Policy {"idle-detection" : []} explicitly set by top-level frame ' +
+}, 'Permissions-Policy idle-detection=() explicitly set by top-level frame ' +
'disallows workers in cross-origin iframes.');
fetch_tests_from_worker(new Worker(
- 'resources/idle-detection-disabled-by-feature-policy-worker.js'))
+ 'resources/idle-detection-disabled-by-permissions-policy-worker.js'))
</script>
</body>
diff --git a/idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html.headers b/idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html.headers
new file mode 100644
index 0000000..289463c
--- /dev/null
+++ b/idle-detection/idle-detection-disabled-by-permissions-policy.https.sub.html.headers
@@ -0,0 +1 @@
+Permissions-Policy: idle-detection=()
diff --git a/idle-detection/resources/idle-detection-allowed-by-feature-policy-worker.js b/idle-detection/resources/idle-detection-allowed-by-permissions-policy-worker.js
similarity index 75%
rename from idle-detection/resources/idle-detection-allowed-by-feature-policy-worker.js
rename to idle-detection/resources/idle-detection-allowed-by-permissions-policy-worker.js
index e643414..1fe410e 100644
--- a/idle-detection/resources/idle-detection-allowed-by-feature-policy-worker.js
+++ b/idle-detection/resources/idle-detection-allowed-by-permissions-policy-worker.js
@@ -11,6 +11,6 @@
promise_test(async () => {
await new IdleDetector().start()
},
- `Inherited header feature policy allows ${workerType} workers.`)
+ `Inherited header permissions policy allows ${workerType} workers.`)
done();
diff --git a/idle-detection/resources/idle-detection-disabled-by-feature-policy-worker.js b/idle-detection/resources/idle-detection-disabled-by-permissions-policy-worker.js
similarity index 86%
rename from idle-detection/resources/idle-detection-disabled-by-feature-policy-worker.js
rename to idle-detection/resources/idle-detection-disabled-by-permissions-policy-worker.js
index 138b291..c30f7c1 100644
--- a/idle-detection/resources/idle-detection-disabled-by-feature-policy-worker.js
+++ b/idle-detection/resources/idle-detection-disabled-by-permissions-policy-worker.js
@@ -2,7 +2,7 @@
importScripts('/resources/testharness.js');
-const header = 'Feature-Policy header {"idle-detection" : []}';
+const header = 'Permissions-Policy header idle-detection=()';
let workerType;
if (typeof postMessage === 'function') {
diff --git a/permissions-policy/resources/permissions-policy-idle-detection-worker.js b/permissions-policy/resources/permissions-policy-idle-detection-worker.js
index 2e4e3cd..0d348c7 100644
--- a/permissions-policy/resources/permissions-policy-idle-detection-worker.js
+++ b/permissions-policy/resources/permissions-policy-idle-detection-worker.js
@@ -6,9 +6,9 @@
switch(event.data.type) {
case 'ready':
new IdleDetector().start().then(() => {
- postMessage({ enabled: true });
+ postMessage({ type: 'availability-result', enabled: true });
}, error => {
- postMessage ({ enabled: false });
+ postMessage ({ type: 'availability-result', enabled: false });
});
break;
}
diff --git a/permissions-policy/resources/permissions-policy-idle-detection.html b/permissions-policy/resources/permissions-policy-idle-detection.html
index 65a5781..f21a385 100644
--- a/permissions-policy/resources/permissions-policy-idle-detection.html
+++ b/permissions-policy/resources/permissions-policy-idle-detection.html
@@ -2,9 +2,9 @@
'use strict';
new IdleDetector().start().then(() => {
- window.parent.postMessage({ enabled: true }, '*');
+ window.parent.postMessage({ type: 'availability-result', enabled: true }, '*');
}, error => {
- window.parent.postMessage({ enabled: false }, '*');
+ window.parent.postMessage({ type: 'availability-result', enabled: false }, '*');
});
</script>