| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Credential Manager: request() basics.</title> | 2 <title>Credential Manager: request() 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 notValid: 'yay!' | 72 notValid: 'yay!' |
| 73 }).then( | 73 }).then( |
| 74 t.step_func(stubResolverUndefinedChecker.bind(t)), | 74 t.step_func(stubResolverUndefinedChecker.bind(t)), |
| 75 t.step_func(stubRejectionChecker.bind(t))); | 75 t.step_func(stubRejectionChecker.bind(t))); |
| 76 }); | 76 }); |
| 77 }()); | 77 }()); |
| 78 | 78 |
| 79 (function () { | 79 (function () { |
| 80 var id = "id"; | 80 var id = "id"; |
| 81 var name = "name"; | 81 var name = "name"; |
| 82 var avatar = "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 avatarURL: 'string', | 89 iconURL: 'string', |
| 90 password: 'string' | 90 password: 'string' |
| 91 }); | 91 }); |
| 92 | 92 |
| 93 assert_equals(c.id, id); | 93 assert_equals(c.id, id); |
| 94 assert_equals(c.name, name); | 94 assert_equals(c.name, name); |
| 95 assert_equals(c.avatarURL, avatar); | 95 assert_equals(c.iconURL, icon); |
| 96 assert_equals(c.password, password); | 96 assert_equals(c.password, password); |
| 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, avatar, passwo
rd); | 103 testRunner.addMockCredentialManagerResponse(id, name, icon, password
); |
| 104 navigator.credentials.request().then( | 104 navigator.credentials.request().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 |