<!DOCTYPE html>
<title>Credential Management API: get() basics.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function(t) {
    return promise_rejects_dom(t, "NotSupportedError",
            navigator.credentials.get());
}, "navigator.credentials.get() with no argument.");

promise_test(function(t) {
    return promise_rejects_dom(t, "NotSupportedError",
            navigator.credentials.get({ }));
}, "navigator.credentials.get() with empty argument.");

promise_test(function(t) {
    return promise_rejects_js(t, TypeError,
            navigator.credentials.get({publicKey: "bogus publicKey data"}));
}, "navigator.credentials.get() with bogus publicKey data");

promise_test(function(t) {
    return promise_rejects_dom(t, "NotSupportedError",
            navigator.credentials.get({bogus_key: "bogus data"}));
}, "navigator.credentials.get() with bogus data");

promise_test(function(t) {
    var controller = new AbortController();
    var options = { signal: controller.signal };

    controller.abort();
    return promise_rejects_dom(t, "AbortError",
        navigator.credentials.get(options));
}, "navigator.credentials.get() with abort signal set");
</script>
