Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html

Issue 1828923003: CREDENTIAL: Teach the 'PasswordCredential(HTMLFormElement)' constructor about URLSearchParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@HTMLFormElement
Patch Set: Rebase+Feedback Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5e1277c24a6cde75a9a050a4044b821e2f63bc44..be246a1e11a2ab5d05efa39ea44a5da94f7a10ce 100644
--- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html
@@ -109,15 +109,7 @@ test(function() {
() => { 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);
+function verify_form_credential(f, credential) {
assert_equals(credential.id, 'musterman');
assert_equals(credential.name, 'friendly name');
assert_equals(credential.iconURL, 'https://example.com/photo');
@@ -148,5 +140,46 @@ test(function () {
assert_throws(new TypeError(), _ => new PasswordCredential(f));
f.removeChild(id);
assert_throws(new TypeError(), _ => new PasswordCredential(f));
-}, 'PasswordCredential creation from `HTMLFormElement`');
+}
+
+test(_ => {
+ var f = document.createElement('form');
+ f.enctype = 'mUlTiPaRt/fOrm-dAtA';
+ 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_true(credential.additionalData instanceof FormData);
+ verify_form_credential(f, credential);
+}, 'PasswordCredential creation from `HTMLFormElement` with a multipart enctype');
+
+test(_ => {
+ var f = document.createElement('form');
+ f.enctype = 'aPplIcaTion/X-wWw-form-urLencoded';
+ 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_true(credential.additionalData instanceof URLSearchParams);
+ verify_form_credential(f, credential);
+}, 'PasswordCredential creation from `HTMLFormElement` with a urlencoded enctype');
+
+test(_ => {
+ 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_true(credential.additionalData instanceof URLSearchParams);
+ verify_form_credential(f, credential);
+}, 'PasswordCredential creation from `HTMLFormElement` with no enctype');
</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698