<!DOCTYPE html>
<title>Credential Management API: create() 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.create());
}, "navigator.credentials.create() with no argument.");

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

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

promise_test(function(t) {
    return promise_rejects_dom(t, "NotSupportedError",
            navigator.credentials.create({bogus_key: "bogus data"}));
}, "navigator.credentials.create() 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.create(options));
}, "navigator.credentials.create() with abort signal set");
</script>
