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

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

Issue 2559273005: [Fetch API] Implement combining of Headers with same keys. (Closed)
Patch Set: Fix for jsbell comment. Created 4 years 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 test(function() { 5 test(function() {
6 var expectedValueMap = { 6 var expectedValueMap = {
7 'content-language': 'ja', 7 'content-language': 'ja',
8 'content-type': 'text/html; charset=UTF-8', 8 'content-type': 'text/html; charset=UTF-8',
9 'x-fetch-test': 'response test field' 9 'x-fetch-test': 'response test field'
10 }; 10 };
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 keys.push(key); 232 keys.push(key);
233 assert_array_equals(keys, ['a', 'b', 'c'], 233 assert_array_equals(keys, ['a', 'b', 'c'],
234 'The pairs to iterate over should be sorted.'); 234 'The pairs to iterate over should be sorted.');
235 }, 'Iteration order'); 235 }, 'Iteration order');
236 236
237 test(function(t) { 237 test(function(t) {
238 const headers = new Headers; 238 const headers = new Headers;
239 headers.set('a', '1'); 239 headers.set('a', '1');
240 headers.set('b', '2'); 240 headers.set('b', '2');
241 headers.set('c', '3'); 241 headers.set('c', '3');
242 headers.append('a', '2');
243 headers.append('a', '3');
242 244
243 const iterator = headers.entries(); 245 const iterator = headers.entries();
244 246
245 headers.delete('a'); 247 headers.delete('a');
246 headers.set('d', '4'); 248 headers.set('d', '4');
247 249
248 const keys = []; 250 const keys = [];
249 for (let [key, value] of iterator) 251 for (let [key, value] of iterator){
250 keys.push(key); 252 keys.push(key);
253 values.push(value);
254 }
251 assert_array_equals(keys, ['a', 'b', 'c'], 255 assert_array_equals(keys, ['a', 'b', 'c'],
252 'The pairs to iterate over should be the return ' + 256 'The pairs to iterate over should be the return ' +
253 'value of an algorithm that implicitly makes a copy.'); 257 'value of an algorithm that implicitly makes a copy.');
258 assert_array_equals(values, ['1,2,3', '2', '3'],
259 "The values should be combined and seperated by ',' ");
jsbell 2016/12/12 21:00:24 spelling: separated nit: remove trailing space in
254 }, 'Iteration mutation'); 260 }, 'Iteration mutation');
255 261
256 done(); 262 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698