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

Side by Side Diff: Source/core/frame/SubresourceIntegrityTest.cpp

Issue 803773002: SRI: Remove the restriction to HTTPS documents and resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/SubresourceIntegrity.h" 6 #include "core/frame/SubresourceIntegrity.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/html/HTMLScriptElement.h" 10 #include "core/html/HTMLScriptElement.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 // The hash label must match the hash value. 204 // The hash label must match the hash value.
205 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL ); 205 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL );
206 206
207 // Unsupported hash functions should fail. 207 // Unsupported hash functions should fail.
208 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu reURL); 208 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu reURL);
209 } 209 }
210 210
211 TEST_F(SubresourceIntegrityTest, CheckSubresourceIntegrityInInsecureOrigin) 211 TEST_F(SubresourceIntegrityTest, CheckSubresourceIntegrityInInsecureOrigin)
212 { 212 {
213 // The same checks as CheckSubresourceIntegrityInSecureOrigin should fail he re. 213 // The same checks as CheckSubresourceIntegrityInSecureOrigin should pass he re.
214 document->updateSecurityOrigin(insecureOrigin->isolatedCopy()); 214 document->updateSecurityOrigin(insecureOrigin->isolatedCopy());
215 215
216 expectIntegrityFailure(kSha256Integrity, kBasicScript, secureURL); 216 expectIntegrity(kSha256Integrity, kBasicScript, secureURL);
217 expectIntegrityFailure(kSha384Integrity, kBasicScript, secureURL); 217 expectIntegrity(kSha384Integrity, kBasicScript, secureURL);
218 expectIntegrityFailure(kSha512Integrity, kBasicScript, secureURL); 218 expectIntegrity(kSha512Integrity, kBasicScript, secureURL);
219 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL ); 219 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL );
220 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu reURL); 220 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu reURL);
221 } 221 }
222 222
223 } // namespace blink 223 } // namespace blink
OLDNEW
« Source/core/frame/SubresourceIntegrity.cpp ('K') | « Source/core/frame/SubresourceIntegrity.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698