Chromium Code Reviews| 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 } |
| 11 | 11 |
| 12 function stubRejectionChecker(reason) { | 12 function stubRejectionChecker(reason) { |
| 13 assert_unreached("get() should not reject, but did: " + reason.name); | 13 assert_unreached("get(...) should not reject, but did: " + reason.name); |
| 14 } | 14 } |
| 15 | 15 |
| 16 (function() { | 16 (function() { |
| 17 var t = async_test("Verify the basics of get()."); | 17 var t = async_test("Verify the basics of get()."); |
| 18 t.step(function () { | 18 t.step(function () { |
| 19 navigator.credentials.get().then( | 19 navigator.credentials.get().then( |
| 20 t.step_func(stubResolverUndefinedChecker.bind(t)), | 20 t.unreached_func(), |
| 21 t.step_func(stubRejectionChecker.bind(t))); | 21 t.step_func(t.done.bind(t))); |
|
philipj_slow
2016/04/25 11:54:21
Looks a bit odd, would t.step_func_done() suffice?
Mike West
2016/04/25 13:03:31
Yes, it would. Thanks!
| |
| 22 }); | 22 }); |
| 23 }()); | 23 }()); |
| 24 | 24 |
| 25 (function() { | 25 (function() { |
| 26 var t = async_test("Verify the basics of get({})."); | 26 var t = async_test("Verify the basics of get({})."); |
| 27 t.step(function () { | 27 t.step(function () { |
| 28 navigator.credentials.get({}).then( | 28 navigator.credentials.get({}).then( |
| 29 t.step_func(stubResolverUndefinedChecker.bind(t)), | 29 t.step_func(stubResolverUndefinedChecker.bind(t)), |
| 30 t.step_func(stubRejectionChecker.bind(t))); | 30 t.step_func(stubRejectionChecker.bind(t))); |
| 31 }); | 31 }); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 if (window.testRunner) | 135 if (window.testRunner) |
| 136 testRunner.addMockCredentialManagerResponse(id, name, icon, password ); | 136 testRunner.addMockCredentialManagerResponse(id, name, icon, password ); |
| 137 navigator.credentials.get({ | 137 navigator.credentials.get({ |
| 138 password: true | 138 password: true |
| 139 }).then( | 139 }).then( |
| 140 t.step_func(stubResolverChecker.bind(t)), | 140 t.step_func(stubResolverChecker.bind(t)), |
| 141 t.step_func(stubRejectionChecker.bind(t))); | 141 t.step_func(stubRejectionChecker.bind(t))); |
| 142 }); | 142 }); |
| 143 }()); | 143 }()); |
| 144 </script> | 144 </script> |
| OLD | NEW |