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

Unified 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: Nits and added Request tests 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/fetch/script-tests/request.js
diff --git a/LayoutTests/http/tests/fetch/script-tests/request.js b/LayoutTests/http/tests/fetch/script-tests/request.js
index f0aacb885a4837b6fcb75a356d5a414055e14331..1a3864b02c2a7beb662b02441df2928b7a949ba2 100644
--- a/LayoutTests/http/tests/fetch/script-tests/request.js
+++ b/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -222,6 +222,29 @@ test(function() {
}, 'Request credentials test');
test(function() {
+ var request1 = {};
+ var request2 = {};
+ var init = {};
+ request1 = new Request(URL, init);
+ assert_equals(request1.integrity, '',
+ 'Request.integrity should be empty on init');
+ init['integrity'] = 'sha256-deadbeef';
+ request1 = new Request(URL, init);
+ assert_equals(request1.integrity, 'sha256-deadbeef',
+ 'Request.integrity match the integrity of init');
+ request2 = new Request(request1);
+ assert_equals(request2.integrity, 'sha256-deadbeef',
+ 'Request.integrity should match');
+ init['mode'] = 'no-cors';
+ assert_throws(
+ {name: 'TypeError'},
+ function() {
+ var request = new Request(URL, init);
+ },
+ 'new Request with a non-empty integrity and mode of \'no-cors\' should throw');
+}, 'Request integrity test');
+
+test(function() {
['same-origin', 'cors', 'no-cors'].forEach(function(mode) {
FORBIDDEN_METHODS.forEach(function(method) {
assert_throws(

Powered by Google App Engine
This is Rietveld 408576698