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

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

Issue 1279163005: Initial Fetch integration for Subresource Integrity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test expectations Created 5 years, 4 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 | LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-fetch.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var URL = 'https://www.example.com/test.html'; 5 var URL = 'https://www.example.com/test.html';
6 6
7 test(function() { 7 test(function() {
8 var headers = new Headers; 8 var headers = new Headers;
9 headers.set('User-Agent', 'Mozilla/5.0'); 9 headers.set('User-Agent', 'Mozilla/5.0');
10 headers.set('Accept', 'text/html'); 10 headers.set('Accept', 'text/html');
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 request2 = new Request(request1, init2); 243 request2 = new Request(request1, init2);
244 assert_equals(request2.redirect, 244 assert_equals(request2.redirect,
245 redirect2 ? redirect2 : request1.redirect, 245 redirect2 ? redirect2 : request1.redirect,
246 'Request.redirect should be overridden'); 246 'Request.redirect should be overridden');
247 }); 247 });
248 }); 248 });
249 }, 'Request redirect test'); 249 }, 'Request redirect test');
250 250
251 test(function() { 251 test(function() {
252 var request1 = {};
253 var request2 = {};
254 var init = {};
255 request1 = new Request(URL, init);
256 assert_equals(request1.integrity, '',
257 'Request.integrity should be empty on init');
258 init['integrity'] = 'sha256-deadbeef';
259 request1 = new Request(URL, init);
260 assert_equals(request1.integrity, 'sha256-deadbeef',
261 'Request.integrity match the integrity of init');
262 request2 = new Request(request1);
263 assert_equals(request2.integrity, 'sha256-deadbeef',
264 'Request.integrity should match');
265 init['mode'] = 'no-cors';
266 assert_throws(
267 {name: 'TypeError'},
268 function() {
269 var request = new Request(URL, init);
270 },
271 'new Request with a non-empty integrity and mode of \'no-cors\' should t hrow');
272 }, 'Request integrity test');
273
274 test(function() {
252 ['same-origin', 'cors', 'no-cors'].forEach(function(mode) { 275 ['same-origin', 'cors', 'no-cors'].forEach(function(mode) {
253 FORBIDDEN_METHODS.forEach(function(method) { 276 FORBIDDEN_METHODS.forEach(function(method) {
254 assert_throws( 277 assert_throws(
255 {name: 'TypeError'}, 278 {name: 'TypeError'},
256 function() { 279 function() {
257 var request = new Request(URL, {mode: mode, method: method}); 280 var request = new Request(URL, {mode: mode, method: method});
258 }, 281 },
259 'new Request with a forbidden method (' + method + ') should ' + 282 'new Request with a forbidden method (' + method + ') should ' +
260 'throw'); 283 'throw');
261 }); 284 });
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 661
639 // Tests for requests context. 662 // Tests for requests context.
640 test(function() { 663 test(function() {
641 var request = new Request('http://localhost/', {method: 'POST', body: ''}); 664 var request = new Request('http://localhost/', {method: 'POST', body: ''});
642 assert_equals(request.context, '', 665 assert_equals(request.context, '',
643 'Request.context should be empty string ' + 666 'Request.context should be empty string ' +
644 'for synthetic Request object'); 667 'for synthetic Request object');
645 }, 'RequestContext of a synthetic Request object'); 668 }, 'RequestContext of a synthetic Request object');
646 669
647 done(); 670 done();
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-fetch.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698