chromium/third_party/blink/web_tests/external/wpt/digital-credentials/enabled-on-self-origin-by-permissions-policy.https.sub.html

<!DOCTYPE html>
<meta charset="utf-8" />
<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 src="/common/get-host-info.sub.js"></script>
<body></body>
<script type="module">
    import { makeGetOptions } from "./support/helper.js";
    const { HTTPS_REMOTE_ORIGIN } = get_host_info();
    const same_origin_src =
        "/permissions-policy/resources/digital-credentials-get.html";
    const cross_origin_src = new URL(same_origin_src, HTTPS_REMOTE_ORIGIN).href;

    promise_test(async (test) => {
        await test_driver.bless("user activation");
        await promise_rejects_js(
            test,
            TypeError,
            navigator.identity.get(makeGetOptions([]))
        );
    }, "Permissions-Policy header digital-credentials-get=(self) allows the top-level document.");

    promise_test(async (test) => {
        await test_feature_availability({
            feature_description: "Digital Credential API",
            test,
            src: same_origin_src,
            expect_feature_available: expect_feature_available_default,
            is_promise_test: true,
            needs_focus: true,
        });
    }, "Permissions-Policy header digital-credentials-get=(self) allows same-origin iframes.");

    promise_test(async (test) => {
        await test_feature_availability({
            feature_description: "Digital Credential API",
            test,
            src: cross_origin_src,
            expect_feature_available: expect_feature_unavailable_default,
            is_promise_test: true,
            needs_focus: true,
        });
    }, "Permissions-Policy header digital-credentials-get=(self) disallows cross-origin iframes.");

    promise_test(async (test) => {
        await test_feature_availability({
            feature_description: "Digital Credential API",
            test,
            src: cross_origin_src,
            expect_feature_available: expect_feature_available_default,
            feature_name: "digital-credentials-get",
            is_promise_test: true,
            needs_focus: true,
        });
    }, "Permissions-Policy header digital-credentials-get=(self) gets overridden by allow attribute.");
</script>