| Index: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
|
| index eced29d615a7555f72d5ff6856e0246dd208d853..5e1277c24a6cde75a9a050a4044b821e2f63bc44 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
|
| @@ -108,4 +108,45 @@ test(function() {
|
| assert_throws(new TypeError(),
|
| () => { new PasswordCredential({ 'id': undefined, 'password': undefined }); });
|
| }, 'PasswordCredential objects require IDs and Passwords');
|
| +
|
| +test(function () {
|
| + var f = document.createElement('form');
|
| + f.innerHTML = "<input type='text' name='theId' value='musterman' autocomplete='username'>"
|
| + + "<input type='text' name='thePassword' value='sekrit' autocomplete='current-password'>"
|
| + + "<input type='text' name='theIcon' value='https://example.com/photo' autocomplete='photo'>"
|
| + + "<input type='text' name='theExtraField' value='extra'>"
|
| + + "<input type='text' name='theName' value='friendly name' autocomplete='name'>";
|
| +
|
| + var credential = new PasswordCredential(f);
|
| + assert_equals(credential.id, 'musterman');
|
| + assert_equals(credential.name, 'friendly name');
|
| + assert_equals(credential.iconURL, 'https://example.com/photo');
|
| + assert_equals(credential.idName, 'theId');
|
| + assert_equals(credential.passwordName, 'thePassword');
|
| + assert_equals(credential.type, 'password');
|
| +
|
| + assert_equals(credential.additionalData.get('theId'), 'musterman');
|
| + assert_equals(credential.additionalData.get('thePassword'), 'sekrit');
|
| + assert_equals(credential.additionalData.get('theIcon'), 'https://example.com/photo');
|
| + assert_equals(credential.additionalData.get('theName'), 'friendly name');
|
| + assert_equals(credential.additionalData.get('theExtraField'), 'extra');
|
| +
|
| + var password = f.querySelector('[name=thePassword]');
|
| + password.value = "";
|
| + assert_throws(new TypeError(), _ => new PasswordCredential(f));
|
| + f.removeChild(password);
|
| + assert_throws(new TypeError(), _ => new PasswordCredential(f));
|
| +
|
| + // Reset the password, do the same test for the ID.
|
| + f.appendChild(password);
|
| + password.value = "sekrit";
|
| + credential = new PasswordCredential(f);
|
| + assert_true(credential instanceof PasswordCredential);
|
| +
|
| + var id = f.querySelector('[name=theId]');
|
| + id.value = "";
|
| + assert_throws(new TypeError(), _ => new PasswordCredential(f));
|
| + f.removeChild(id);
|
| + assert_throws(new TypeError(), _ => new PasswordCredential(f));
|
| +}, 'PasswordCredential creation from `HTMLFormElement`');
|
| </script>
|
|
|