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

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

Issue 1862293003: Fetch: Fix 'body' processing in RequestInit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var c = new PasswordCredential({ 7 var c = new PasswordCredential({
8 id: 'id', 8 id: 'id',
9 password: 'pencil', 9 password: 'pencil',
10 name: 'name', 10 name: 'name',
11 iconURL: 'https://example.com/icon.png' 11 iconURL: 'https://example.com/icon.png'
12 }); 12 });
13 13
14 promise_test(_ => { 14 promise_test(_ => {
15 var r = new Request('/', { credentials: c, body: 'this is a body', method: ' POST' });
16 return r.text().then(t => assert_equals(t, ""));
17 }, "Body ignored in presence of a PasswordCredential");
18
19 promise_test(_ => {
20 var r = new Request('/', { credentials: 'include', body: 'this is a body', m ethod: 'POST' });
21 return r.text().then(t => assert_equals(t, "this is a body"));
22 }, "Body present if 'credentials' is not a PasswordCredential");
23
24 promise_test(_ => {
15 var r = new Request('/', { credentials: c, method: 'POST' }); 25 var r = new Request('/', { credentials: c, method: 'POST' });
16 var clone = r.clone(); 26 var clone = r.clone();
17 assert_equals(r.credentials, "password"); 27 assert_equals(r.credentials, "password");
18 assert_equals(clone.credentials, "password"); 28 assert_equals(clone.credentials, "password");
19 return Promise.all([ 29 return Promise.all([
20 r.text().then(t => assert_equals(t, "")), 30 r.text().then(t => assert_equals(t, "")),
21 clone.text().then(t => assert_equals(t, "")) 31 clone.text().then(t => assert_equals(t, ""))
22 ]); 32 ]);
23 }, "Creating/cloning a 'Request' does not expose the credential."); 33 }, "Creating/cloning a 'Request' does not expose the credential.");
24 34
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 285
276 return fetch("./resources/echo-raw-post.php", { credentials: credential, met hod: "POST" }) 286 return fetch("./resources/echo-raw-post.php", { credentials: credential, met hod: "POST" })
277 .then(function (r) { 287 .then(function (r) {
278 return r.text(); 288 return r.text();
279 }) 289 })
280 .then(function (t) { 290 .then(function (t) {
281 assert_equals(t, 'a=1&a=2&a=3&username=id&password=pencil'); 291 assert_equals(t, 'a=1&a=2&a=3&username=id&password=pencil');
282 }); 292 });
283 }, "'additionalData': URLSearchParams properties are properly injected (ordering matters)."); 293 }, "'additionalData': URLSearchParams properties are properly injected (ordering matters).");
284 </script> 294 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698