2 <title>Credential Manager: store() basics.
</title>
3 <script src=
"../resources/testharness.js"></script>
4 <script src=
"../resources/testharnessreport.js"></script>
6 function stubResolverChecker(c
) {
7 assert_equals(c
, undefined, "FIXME: We're currently always returning 'undefined'.");
11 function stubRejectionChecker(reason
) {
12 assert_unreached("store() should not reject, but did: " + reason
.name
);
15 var local
= new PasswordCredential({
19 iconURL
: 'https://example.com/icon.png'
22 var federated
= new FederatedCredential({
24 provider
: 'https://federation.test/',
26 iconURL
: 'https://example.test/icon.png'
29 async_test(function () {
30 navigator
.credentials
.store().then(
31 this.step_func(function () { assert_unreached("store() should reject."); }),
32 this.step_func(function (reason
) {
33 assert_equals(reason
.name
, "TypeError");
36 }, "Verify the basics of store(): PasswordCredential.");
38 async_test(function () {
39 navigator
.credentials
.store("not a credential").then(
40 this.step_func(function () { assert_unreached("store([string]) should reject."); }),
41 this.step_func(function (reason
) {
42 assert_equals(reason
.name
, "TypeError");
45 }, "Verify the basics of store(): PasswordCredential.");
47 async_test(function () {
48 navigator
.credentials
.store(local
).then(
49 this.step_func(stubResolverChecker
.bind(this)),
50 this.step_func(stubRejectionChecker
.bind(this)));
51 }, "Verify the basics of store(): PasswordCredential.");
53 async_test(function () {
54 navigator
.credentials
.store(federated
).then(
55 this.step_func(stubResolverChecker
.bind(this)),
56 this.step_func(stubRejectionChecker
.bind(this)));
57 }, "Verify the basics of store(): FederatedCredential.");