OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Credential Manager: store() basics.</title> | 2 <title>Credential Manager: store() basics.</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 function stubResolverChecker(c) { | 6 function stubResolverChecker(c) { |
7 assert_equals(c, undefined, "FIXME: We're currently always returning 'undefi
ned'."); | 7 assert_equals(c, undefined, "FIXME: We're currently always returning 'undefi
ned'."); |
8 this.done(); | 8 this.done(); |
9 } | 9 } |
10 | 10 |
11 function stubRejectionChecker(reason) { | 11 function stubRejectionChecker(reason) { |
12 assert_unreached("store() should not reject, but did: " + reason.name); | 12 assert_unreached("store() should not reject, but did: " + reason.name); |
13 } | 13 } |
14 | 14 |
15 var local = new PasswordCredential('id', 'pencil', 'name', 'https://example.com/
icon.png'); | 15 var local = new PasswordCredential({ |
| 16 id: 'id', |
| 17 password: 'pencil', |
| 18 name: 'name', |
| 19 iconURL: 'https://example.com/icon.png' |
| 20 }); |
| 21 |
16 var federated = new FederatedCredential({ | 22 var federated = new FederatedCredential({ |
17 'id': 'id', | 23 id: 'id', |
18 'provider': 'https://federation.test/', | 24 provider: 'https://federation.test/', |
19 'name': 'name', | 25 name: 'name', |
20 'iconURL': 'https://example.test/icon.png' | 26 iconURL: 'https://example.test/icon.png' |
21 }); | 27 }); |
22 | 28 |
23 async_test(function () { | 29 async_test(function () { |
24 navigator.credentials.store().then( | 30 navigator.credentials.store().then( |
25 this.step_func(function () { assert_unreached("store() should reject.");
}), | 31 this.step_func(function () { assert_unreached("store() should reject.");
}), |
26 this.step_func(function (reason) { | 32 this.step_func(function (reason) { |
27 assert_equals(reason.name, "TypeError"); | 33 assert_equals(reason.name, "TypeError"); |
28 this.done(); | 34 this.done(); |
29 })); | 35 })); |
30 }, "Verify the basics of store(): PasswordCredential."); | 36 }, "Verify the basics of store(): PasswordCredential."); |
(...skipping 12 matching lines...) Expand all Loading... |
43 this.step_func(stubResolverChecker.bind(this)), | 49 this.step_func(stubResolverChecker.bind(this)), |
44 this.step_func(stubRejectionChecker.bind(this))); | 50 this.step_func(stubRejectionChecker.bind(this))); |
45 }, "Verify the basics of store(): PasswordCredential."); | 51 }, "Verify the basics of store(): PasswordCredential."); |
46 | 52 |
47 async_test(function () { | 53 async_test(function () { |
48 navigator.credentials.store(federated).then( | 54 navigator.credentials.store(federated).then( |
49 this.step_func(stubResolverChecker.bind(this)), | 55 this.step_func(stubResolverChecker.bind(this)), |
50 this.step_func(stubRejectionChecker.bind(this))); | 56 this.step_func(stubRejectionChecker.bind(this))); |
51 }, "Verify the basics of store(): FederatedCredential."); | 57 }, "Verify the basics of store(): FederatedCredential."); |
52 </script> | 58 </script> |
OLD | NEW |