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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js

Issue 2783623003: Fetch API: Don't exclude the URL fragment in Request#url (Closed)
Patch Set: address comments Created 3 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
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('../resources/fetch-test-helpers.js'); 2 importScripts('../resources/fetch-test-helpers.js');
3 } 3 }
4 4
5 promise_test(function(t) { 5 promise_test(function(t) {
6 return fetch('http://') 6 return fetch('http://')
7 .then( 7 .then(
8 t.unreached_func('fetch of invalid URL must fail'), 8 t.unreached_func('fetch of invalid URL must fail'),
9 function() {}); 9 function() {});
10 }, 'Fetch invalid URL'); 10 }, 'Fetch invalid URL');
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 assert_array_equals( 159 assert_array_equals(
160 self.internals.getInternalResponseURLList(response), 160 self.internals.getInternalResponseURLList(response),
161 [request.url]); 161 [request.url]);
162 } 162 }
163 }); 163 });
164 }, 'Fetch result of 404 response'); 164 }, 'Fetch result of 404 response');
165 165
166 promise_test(function(t) { 166 promise_test(function(t) {
167 var request = new Request( 167 var request = new Request(
168 '/fetch/resources/fetch-status.php?status=200#fragment'); 168 '/fetch/resources/fetch-status.php?status=200#fragment');
169
170 // The url attribute's getter must return request's url,
171 // serialized with the exclude fragment flag set.
172 assert_equals(request.url, 169 assert_equals(request.url,
173 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200'); 170 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200#fragment');
174 171
175 return fetch(request) 172 return fetch(request)
176 .then(function(response) { 173 .then(function(response) {
177 assert_equals(response.status, 200); 174 assert_equals(response.status, 200);
178 assert_equals(response.statusText, 'OK'); 175 assert_equals(response.statusText, 'OK');
179 // The url attribute's getter must return the empty string 176 // The url attribute's getter must return the empty string
180 // if response's url is null and response's url, 177 // if response's url is null and response's url,
181 // serialized with the exclude fragment flag set, otherwise. 178 // serialized with the exclude fragment flag set, otherwise.
182 assert_equals(response.url, 179 assert_equals(response.url,
183 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200'); 180 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200');
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 assert_true(req.bodyUsed); 440 assert_true(req.bodyUsed);
444 }, 'Calling fetch() disturbs body if not null'); 441 }, 'Calling fetch() disturbs body if not null');
445 442
446 test(t => { 443 test(t => {
447 var req = new Request('/', {method: 'POST'}); 444 var req = new Request('/', {method: 'POST'});
448 fetch(req); 445 fetch(req);
449 assert_false(req.bodyUsed); 446 assert_false(req.bodyUsed);
450 }, 'Calling fetch() doesn\'t disturb body if null'); 447 }, 'Calling fetch() doesn\'t disturb body if null');
451 448
452 done(); 449 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698