| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Credential Manager: PasswordCredential basics.</title> | 2 <title>Credential Manager: PasswordCredential 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 test(function() { | 7 test(function() { |
| 8 var credential = new PasswordCredential('id', 'pencil', 'name', 'https://exa
mple.com/avatar.png'); | 8 var credential = new PasswordCredential('id', 'pencil', 'name', 'https://exa
mple.com/icon.png'); |
| 9 | 9 |
| 10 verify_interface('PasswordCredential', credential, { | 10 verify_interface('PasswordCredential', credential, { |
| 11 formData: 'object', | 11 formData: 'object', |
| 12 id: 'string', | 12 id: 'string', |
| 13 name: 'string', | 13 name: 'string', |
| 14 avatarURL: 'string', | 14 iconURL: 'string', |
| 15 password: 'string', | 15 password: 'string', |
| 16 type: 'string' | 16 type: 'string' |
| 17 }); | 17 }); |
| 18 | 18 |
| 19 assert_true(credential.formData instanceof FormData); | 19 assert_true(credential.formData instanceof FormData); |
| 20 assert_equals(credential.id, 'id'); | 20 assert_equals(credential.id, 'id'); |
| 21 assert_equals(credential.name, 'name'); | 21 assert_equals(credential.name, 'name'); |
| 22 assert_equals(credential.avatarURL, 'https://example.com/avatar.png'); | 22 assert_equals(credential.iconURL, 'https://example.com/icon.png'); |
| 23 assert_equals(credential.password, 'pencil'); | 23 assert_equals(credential.password, 'pencil'); |
| 24 assert_equals(credential.type, 'password'); | 24 assert_equals(credential.type, 'password'); |
| 25 }, 'Interfaces and attributes of PasswordCredential'); | 25 }, 'Interfaces and attributes of PasswordCredential'); |
| 26 | 26 |
| 27 test(function() { | 27 test(function() { |
| 28 assert_throws(new SyntaxError(), function () { | 28 assert_throws(new SyntaxError(), function () { |
| 29 var credential = new PasswordCredential('id', 'pencil', 'name', '-'); | 29 var credential = new PasswordCredential('id', 'pencil', 'name', '-'); |
| 30 }); | 30 }); |
| 31 }, 'Construct a PasswordCredential with an invalid avatar URL.'); | 31 }, 'Construct a PasswordCredential with an invalid icon URL.'); |
| 32 | 32 |
| 33 test(function() { | 33 test(function() { |
| 34 var credential = new PasswordCredential('id', 'pencil', 'name'); | 34 var credential = new PasswordCredential('id', 'pencil', 'name'); |
| 35 | 35 |
| 36 assert_equals(credential.id, 'id'); | 36 assert_equals(credential.id, 'id'); |
| 37 assert_equals(credential.name, 'name'); | 37 assert_equals(credential.name, 'name'); |
| 38 assert_equals(credential.avatarURL, ''); | 38 assert_equals(credential.iconURL, ''); |
| 39 assert_equals(credential.password, 'pencil'); | 39 assert_equals(credential.password, 'pencil'); |
| 40 assert_equals(credential.type, 'password'); | 40 assert_equals(credential.type, 'password'); |
| 41 | 41 |
| 42 }, 'Construct a PasswordCredential with an empty avatar URL.'); | 42 }, 'Construct a PasswordCredential with an empty icon URL.'); |
| 43 | 43 |
| 44 test(function() { | 44 test(function() { |
| 45 var credential = new PasswordCredential('id', 'pencil'); | 45 var credential = new PasswordCredential('id', 'pencil'); |
| 46 | 46 |
| 47 assert_equals(credential.id, 'id'); | 47 assert_equals(credential.id, 'id'); |
| 48 assert_equals(credential.name, ''); | 48 assert_equals(credential.name, ''); |
| 49 assert_equals(credential.avatarURL, ''); | 49 assert_equals(credential.iconURL, ''); |
| 50 assert_equals(credential.password, 'pencil'); | 50 assert_equals(credential.password, 'pencil'); |
| 51 assert_equals(credential.type, 'password'); | 51 assert_equals(credential.type, 'password'); |
| 52 | 52 |
| 53 }, 'Construct a PasswordCredential with an empty name and avatar URL.'); | 53 }, 'Construct a PasswordCredential with an empty name and icon URL.'); |
| 54 </script> | 54 </script> |
| OLD | NEW |