Chromium Code Reviews| 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="resources/interfaces.js"></script> | 5 <script src="/w3c/resources/WebIDLParser.js"></script> |
| 6 <script src="/w3c/resources/idlharness.js"></script> | |
| 7 <script type="text/plain" id="tested"> | |
| 8 [Exposed=Window, SecureContext] | |
| 9 interface Credential { | |
| 10 readonly attribute USVString id; | |
| 11 readonly attribute DOMString type; | |
| 12 }; | |
| 13 | |
| 14 dictionary CredentialData { | |
| 15 required USVString id; | |
| 16 }; | |
| 17 | |
| 18 [NoInterfaceObject, SecureContext] | |
| 19 interface CredentialUserData { | |
| 20 readonly attribute USVString name; | |
| 21 readonly attribute USVString iconURL; | |
| 22 }; | |
| 23 | |
| 24 dictionary PasswordCredentialData : CredentialData { | |
| 25 USVString name; | |
| 26 USVString iconURL; | |
| 27 required USVString password; | |
| 28 }; | |
| 29 | |
| 30 [Constructor(HTMLFormElement form), | |
| 31 Constructor(PasswordCredentialData data), | |
| 32 Exposed=Window, | |
| 33 SecureContext] | |
| 34 interface PasswordCredential : Credential { | |
| 35 readonly attribute USVString password; | |
| 36 }; | |
| 37 PasswordCredential implements CredentialUserData; | |
| 38 </script> | |
| 6 <script> | 39 <script> |
| 40 var idl_array = new IdlArray(); | |
| 41 idl_array.add_idls(document.querySelector('#tested').textContent); | |
| 42 idl_array.add_objects({ | |
| 43 PasswordCredential: ['new PasswordCredential({ id: "id", password: "pencil" })'] | |
| 44 }); | |
| 45 idl_array.test(); | |
|
Mike West
2017/05/29 12:10:38
Likewise.
mike3
2017/05/29 17:41:12
Done.
| |
| 46 | |
| 7 test(function() { | 47 test(function() { |
| 8 var credential = new PasswordCredential({ | 48 var credential = new PasswordCredential({ |
| 9 id: 'id', | 49 id: 'id', |
| 10 password: 'pencil', | 50 password: 'pencil', |
| 11 name: 'name', | 51 name: 'name', |
| 12 iconURL: 'https://example.com/icon.png' | 52 iconURL: 'https://example.com/icon.png' |
| 13 }); | 53 }); |
| 14 | 54 |
| 15 verify_interface('PasswordCredential', credential, { | |
| 16 id: 'string', | |
| 17 name: 'string', | |
| 18 iconURL: 'string', | |
| 19 type: 'string' | |
| 20 }); | |
| 21 | |
| 22 assert_equals(credential.id, 'id'); | 55 assert_equals(credential.id, 'id'); |
| 23 assert_equals(credential.name, 'name'); | 56 assert_equals(credential.name, 'name'); |
| 24 assert_equals(credential.iconURL, 'https://example.com/icon.png'); | 57 assert_equals(credential.iconURL, 'https://example.com/icon.png'); |
| 25 assert_equals(credential.type, 'password'); | 58 assert_equals(credential.type, 'password'); |
| 26 assert_equals(credential.idName, 'username'); | 59 assert_equals(credential.idName, 'username'); |
| 27 assert_equals(credential.passwordName, 'password'); | 60 assert_equals(credential.passwordName, 'password'); |
| 28 assert_equals(credential.additionalData, null); | 61 assert_equals(credential.additionalData, null); |
| 29 assert_equals(credential.password, 'pencil'); | 62 assert_equals(credential.password, 'pencil'); |
| 30 }, 'Interfaces and attributes of PasswordCredential'); | 63 }, 'Interfaces and attributes of PasswordCredential'); |
| 31 | 64 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 + "<input type='text' name='thePassword' value='sekrit' autocomplete='cu rrent-password value1'>" | 229 + "<input type='text' name='thePassword' value='sekrit' autocomplete='cu rrent-password value1'>" |
| 197 + "<input type='text' name='theIcon' value='https://example.com/photo' a utocomplete='photo value2'>" | 230 + "<input type='text' name='theIcon' value='https://example.com/photo' a utocomplete='photo value2'>" |
| 198 + "<input type='text' name='theExtraField' value='extra'>" | 231 + "<input type='text' name='theExtraField' value='extra'>" |
| 199 + "<input type='text' name='theName' value='friendly name' autocomplete= 'name value3'>"; | 232 + "<input type='text' name='theName' value='friendly name' autocomplete= 'name value3'>"; |
| 200 | 233 |
| 201 var credential = new PasswordCredential(f); | 234 var credential = new PasswordCredential(f); |
| 202 assert_true(credential.additionalData instanceof URLSearchParams); | 235 assert_true(credential.additionalData instanceof URLSearchParams); |
| 203 verify_form_credential(f, credential); | 236 verify_form_credential(f, credential); |
| 204 }, 'PasswordCredential creation from `HTMLFormElement` with multiple autocomplet e attributes'); | 237 }, 'PasswordCredential creation from `HTMLFormElement` with multiple autocomplet e attributes'); |
| 205 </script> | 238 </script> |
| OLD | NEW |