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

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

Issue 1472143003: PasswordCredential should remove entries named idName or passwordName in additionalData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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-fetch.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch.html
index 911ecadb462952626daa00fcb39d174662103720..da43aef0a1aa5b74033e428ed43a6f188eb303dc 100644
--- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch.html
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-fetch.html
@@ -83,7 +83,7 @@ promise_test(function() {
.then(function (r) {
return r.json();
})
- then(function (j) {
+ .then(function (j) {
assert_equals(j.username, 'id');
assert_equals(j.password, 'pencil');
assert_equals(j.excitingData, 'exciting value');
@@ -99,6 +99,37 @@ promise_test(function() {
iconURL: 'https://example.com/icon.png'
});
+ var fd = new FormData();
+ fd.append("username", "foo");
+ fd.append("password", "bar");
+ credential.additionalData = fd;
+
+ // Use post-echo.cgi since PHP doesn't give us the raw data of a POST's
+ // body if it's multipart/form-data.
+ return fetch("/xmlhttprequest/resources/post-echo.cgi", { body: credential, method: "POST" })
+ .then(function (r) {
+ return r.text();
+ })
+ .then(function (t) {
+ // Match "CRLF *OCTET CRLF". See RFC 2046 for the multipart
+ // grammar.
+ assert_false(
+ /\r\nfoo\r\n/.test(t),
+ "POST data should not contain the overridden value foo.");
+ assert_false(
+ /\r\nbar\r\n/.test(t),
+ "POST data should not contain the overridden value bar.");
+ });
+}, "'additionalData': FormData properties are properly overridden.");
+
+promise_test(function() {
+ var credential = new PasswordCredential({
+ id: 'id',
+ password: 'pencil',
+ name: 'name',
+ iconURL: 'https://example.com/icon.png'
+ });
+
var params = new URLSearchParams();
credential.additionalData = params;
@@ -146,6 +177,28 @@ promise_test(function() {
});
var params = new URLSearchParams();
+ params.append("username", "foo");
+ params.append("password", "bar");
+ credential.additionalData = params;
+
+ return fetch("./resources/echo-raw-post.php", { body: credential, method: "POST" })
+ .then(function (r) {
+ return r.text();
+ })
+ .then(function (t) {
+ assert_equals(t, 'username=id&password=pencil');
+ });
+}, "'additionalData': URLSearchParams properties are properly overridden.");
+
+promise_test(function() {
+ var credential = new PasswordCredential({
+ id: 'id',
+ password: 'pencil',
+ name: 'name',
+ iconURL: 'https://example.com/icon.png'
+ });
+
+ var params = new URLSearchParams();
params.append("a", "1");
params.append("a", "2");
params.append("a", "3");
« 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