OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Credential Manager: notifySignedIn() basics.</title> | 2 <title>Credential Manager: notifySignedIn() 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("notifySignedIn() should not reject, but did: " + reason.na
me); | 12 assert_unreached("notifySignedIn() should not reject, but did: " + reason.na
me); |
13 } | 13 } |
14 | 14 |
15 var local = new PasswordCredential('id', 'pencil', 'name', 'https://example.com/
avatar.png'); | 15 var local = new PasswordCredential('id', 'pencil', 'name', 'https://example.com/
avatar.png'); |
16 var federated = new FederatedCredential({ | 16 var federated = new FederatedCredential({ |
17 'id': 'id', | 17 'id': 'id', |
18 'provider': 'https://federation.test/', | 18 'provider': 'https://federation.test/', |
19 'name': 'name', | 19 'name': 'name', |
20 'iconURL': 'https://example.test/icon.png' | 20 'iconURL': 'https://example.test/icon.png' |
21 }); | 21 }); |
22 | 22 |
23 async_test(function () { | 23 async_test(function () { |
24 navigator.credentials.notifySignedIn().then( | 24 navigator.credentials.notifySignedIn().then( |
25 this.step_func(function () { assert_unreached("notifySignedIn() should r
eject."); }), | 25 this.step_func(function () { assert_unreached("notifySignedIn() should r
eject."); }), |
26 this.step_func(function (reason) { | 26 this.step_func(function (reason) { |
27 assert_equals(reason.name, "TypeError"); | 27 assert_equals(reason.name, "TypeError"); |
28 this.done(); | 28 this.done(); |
29 })); | 29 })); |
30 }, "Verify the basics of notifyFailedSignIn(): PasswordCredential."); | 30 }, "Verify the basics of notifySignedIn(): PasswordCredential."); |
31 | 31 |
32 async_test(function () { | 32 async_test(function () { |
33 navigator.credentials.notifySignedIn("not a credential").then( | 33 navigator.credentials.notifySignedIn("not a credential").then( |
34 this.step_func(function () { assert_unreached("notifySignedIn([string])
should reject."); }), | 34 this.step_func(function () { assert_unreached("notifySignedIn([string])
should reject."); }), |
35 this.step_func(function (reason) { | 35 this.step_func(function (reason) { |
36 assert_equals(reason.name, "TypeError"); | 36 assert_equals(reason.name, "TypeError"); |
37 this.done(); | 37 this.done(); |
38 })); | 38 })); |
39 }, "Verify the basics of notifyFailedSignIn(): PasswordCredential."); | 39 }, "Verify the basics of notifySignedIn(): PasswordCredential."); |
40 | 40 |
41 async_test(function () { | 41 async_test(function () { |
42 navigator.credentials.notifySignedIn(local).then( | 42 navigator.credentials.notifySignedIn(local).then( |
43 this.step_func(stubResolverChecker.bind(this)), | 43 this.step_func(stubResolverChecker.bind(this)), |
44 this.step_func(stubRejectionChecker.bind(this))); | 44 this.step_func(stubRejectionChecker.bind(this))); |
45 }, "Verify the basics of notifySignedIn(): PasswordCredential."); | 45 }, "Verify the basics of notifySignedIn(): PasswordCredential."); |
46 | 46 |
47 async_test(function () { | 47 async_test(function () { |
48 navigator.credentials.notifySignedIn(federated).then( | 48 navigator.credentials.notifySignedIn(federated).then( |
49 this.step_func(stubResolverChecker.bind(this)), | 49 this.step_func(stubResolverChecker.bind(this)), |
50 this.step_func(stubRejectionChecker.bind(this))); | 50 this.step_func(stubRejectionChecker.bind(this))); |
51 }, "Verify the basics of notifySignedIn(): FederatedCredential."); | 51 }, "Verify the basics of notifySignedIn(): FederatedCredential."); |
52 </script> | 52 </script> |
OLD | NEW |