| 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="/serviceworker/resources/interfaces.js"></script> | 5 <script src="/serviceworker/resources/interfaces.js"></script> |
| 6 <script> | 6 <script> |
| 7 function stubResolverUndefinedChecker(c) { | 7 function stubResolverUndefinedChecker(c) { |
| 8 assert_equals(c, undefined); | 8 assert_equals(c, undefined); |
| 9 this.done(); | 9 this.done(); |
| 10 } | 10 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 (function () { | 79 (function () { |
| 80 var id = "id"; | 80 var id = "id"; |
| 81 var name = "name"; | 81 var name = "name"; |
| 82 var icon = "http://example.com/"; | 82 var icon = "http://example.com/"; |
| 83 var password = "pencil"; | 83 var password = "pencil"; |
| 84 | 84 |
| 85 function stubResolverChecker(c) { | 85 function stubResolverChecker(c) { |
| 86 verify_interface('PasswordCredential', c, { | 86 verify_interface('PasswordCredential', c, { |
| 87 id: 'string', | 87 id: 'string', |
| 88 name: 'string', | 88 name: 'string', |
| 89 iconURL: 'string', | 89 iconURL: 'string' |
| 90 password: 'string' | |
| 91 }); | 90 }); |
| 92 | 91 |
| 93 assert_equals(c.id, id); | 92 assert_equals(c.id, id); |
| 94 assert_equals(c.name, name); | 93 assert_equals(c.name, name); |
| 95 assert_equals(c.iconURL, icon); | 94 assert_equals(c.iconURL, icon); |
| 96 assert_equals(c.password, password); | 95 assert_true(c.toFormData() instanceof FormData); |
| 96 |
| 97 this.done(); | 97 this.done(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 var t = async_test("Verify that the mock returns the values we give it."); | 100 var t = async_test("Verify that the mock returns the values we give it."); |
| 101 t.step(function() { | 101 t.step(function() { |
| 102 if (window.testRunner) | 102 if (window.testRunner) |
| 103 testRunner.addMockCredentialManagerResponse(id, name, icon, password
); | 103 testRunner.addMockCredentialManagerResponse(id, name, icon, password
); |
| 104 navigator.credentials.get().then( | 104 navigator.credentials.get().then( |
| 105 t.step_func(stubResolverChecker.bind(t)), | 105 t.step_func(stubResolverChecker.bind(t)), |
| 106 t.step_func(stubRejectionChecker.bind(t))); | 106 t.step_func(stubRejectionChecker.bind(t))); |
| 107 }); | 107 }); |
| 108 }()); | 108 }()); |
| 109 </script> | 109 </script> |
| OLD | NEW |