Files
sousa-gecko/testing/web-platform/tests/geolocation/enabled-by-permission-policy-attribute.https.sub.html
T
David P 6dd66b2fbc Bug 1937188: Restore geolocation permission for wpt geolocation policy tests and make attribute tests more similar r=saschanaz,jgraham
Permission was removed from permissions-policy-geolocation.html upstream but not
re-added to the individual tests.  These two tests need it.  They were
incorrectly passing in CI due to the tests that run before them
(disabled-by-permissions-policy.https.sub.html) granting the permission --
they would fail when run individually.

This also does some cosmetic cleanup to make it clear that the tests are
very similar.  This includes renaming the tests from "Geolocation API"
to "Geolocation", as the name was changed in Bug 1902628 [wpt PR 46750].

Additionally, enabled-by-permission-policy-attribute fails in test-verify mode
as an async_test -- the async setup function is not compatible with
that.  enabled-by-permission-policy-attribute-redirect-on-load
is the same test but with a redirect -- it is a promise_test.  This
switches enabled-by-permission-policy-attribute to work as a promise_test,
which fixes the test-verify issue.

Differential Revision: https://phabricator.services.mozilla.com/D232772
2025-01-17 17:59:42 +00:00

42 lines
1.4 KiB
HTML

<!DOCTYPE html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/permissions-policy/resources/permissions-policy.js"></script>
<script>
"use strict";
const same_origin_src =
"/permissions-policy/resources/permissions-policy-geolocation.html";
const cross_origin_src =
"https://{{hosts[alt][]}}:{{ports[https][0]}}" + same_origin_src;
// Grant permission to outer frame
promise_setup(async () => {
await test_driver.set_permission({ name: "geolocation" }, "granted");
});
promise_test(async (test) => {
await test_feature_availability(
"Geolocation",
test,
same_origin_src,
expect_feature_available_default,
"geolocation"
);
}, 'Permissions policy "geolocation" can be enabled in same-origin iframe using allow="geolocation" attribute');
promise_test(async (test) => {
await test_feature_availability(
"Geolocation",
test,
cross_origin_src,
expect_feature_available_default,
"geolocation"
);
}, 'Permissions policy "geolocation" can be enabled in cross-origin iframe using allow="geolocation" attribute');
</script>
</body>