| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Credential Manager: get() basics.</title> | 2 <title>Credential Manager: get() 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 src="resources/interfaces.js"></script> | |
| 6 <script> | 5 <script> |
| 7 function stubResolverUndefinedChecker(c) { | 6 function stubResolverUndefinedChecker(c) { |
| 8 assert_equals(c, undefined); | 7 assert_equals(c, undefined); |
| 9 this.done(); | 8 this.done(); |
| 10 } | 9 } |
| 11 | 10 |
| 12 function stubRejectionChecker(reason) { | 11 function stubRejectionChecker(reason) { |
| 13 assert_unreached("get(...) should not reject, but did: " + reason.name); | 12 assert_unreached("get(...) should not reject, but did: " + reason.name); |
| 14 } | 13 } |
| 15 | 14 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 }); | 122 }); |
| 124 }()); | 123 }()); |
| 125 | 124 |
| 126 (function () { | 125 (function () { |
| 127 var id = "id"; | 126 var id = "id"; |
| 128 var name = "name"; | 127 var name = "name"; |
| 129 var icon = "http://example.com/"; | 128 var icon = "http://example.com/"; |
| 130 var password = "pencil"; | 129 var password = "pencil"; |
| 131 | 130 |
| 132 function stubResolverChecker(c) { | 131 function stubResolverChecker(c) { |
| 133 verify_interface('PasswordCredential', c, { | |
| 134 id: 'string', | |
| 135 name: 'string', | |
| 136 iconURL: 'string' | |
| 137 }); | |
| 138 | |
| 139 assert_equals(c.id, id); | 132 assert_equals(c.id, id); |
| 140 assert_equals(c.name, name); | 133 assert_equals(c.name, name); |
| 141 assert_equals(c.iconURL, icon); | 134 assert_equals(c.iconURL, icon); |
| 142 assert_equals(c.idName, 'username'); | 135 assert_equals(c.idName, 'username'); |
| 143 assert_equals(c.passwordName, 'password'); | 136 assert_equals(c.passwordName, 'password'); |
| 144 assert_equals(c.additionalData, null); | 137 assert_equals(c.additionalData, null); |
| 145 | 138 |
| 146 this.done(); | 139 this.done(); |
| 147 } | 140 } |
| 148 | 141 |
| 149 var t = async_test("Verify that the mock returns the values we give it."); | 142 var t = async_test("Verify that the mock returns the values we give it."); |
| 150 t.step(function() { | 143 t.step(function() { |
| 151 if (window.testRunner) | 144 if (window.testRunner) |
| 152 testRunner.setMockCredentialManagerResponse(id, name, icon, password
); | 145 testRunner.setMockCredentialManagerResponse(id, name, icon, password
); |
| 153 navigator.credentials.get({ | 146 navigator.credentials.get({ |
| 154 password: true | 147 password: true |
| 155 }).then( | 148 }).then( |
| 156 t.step_func(stubResolverChecker.bind(t)), | 149 t.step_func(stubResolverChecker.bind(t)), |
| 157 t.step_func(stubRejectionChecker.bind(t))); | 150 t.step_func(stubRejectionChecker.bind(t))); |
| 158 }); | 151 }); |
| 159 }()); | 152 }()); |
| 160 </script> | 153 </script> |
| OLD | NEW |