OLD | NEW |
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 // The hash label must match the hash value. | 280 // The hash label must match the hash value. |
281 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL
); | 281 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL
); |
282 | 282 |
283 // Unsupported hash functions should fail. | 283 // Unsupported hash functions should fail. |
284 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu
reURL); | 284 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu
reURL); |
285 } | 285 } |
286 | 286 |
287 TEST_F(SubresourceIntegrityTest, CheckSubresourceIntegrityInInsecureOrigin) | 287 TEST_F(SubresourceIntegrityTest, CheckSubresourceIntegrityInInsecureOrigin) |
288 { | 288 { |
289 // The same checks as CheckSubresourceIntegrityInSecureOrigin should fail he
re. | 289 // The same checks as CheckSubresourceIntegrityInSecureOrigin should pass he
re. |
290 document->updateSecurityOrigin(insecureOrigin->isolatedCopy()); | 290 document->updateSecurityOrigin(insecureOrigin->isolatedCopy()); |
291 | 291 |
292 expectIntegrityFailure(kSha256Integrity, kBasicScript, secureURL); | 292 expectIntegrity(kSha256Integrity, kBasicScript, secureURL); |
293 expectIntegrityFailure(kSha384Integrity, kBasicScript, secureURL); | 293 expectIntegrity(kSha384Integrity, kBasicScript, secureURL); |
294 expectIntegrityFailure(kSha512Integrity, kBasicScript, secureURL); | 294 expectIntegrity(kSha512Integrity, kBasicScript, secureURL); |
295 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL
); | 295 expectIntegrityFailure(kSha384IntegrityLabeledAs256, kBasicScript, secureURL
); |
296 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu
reURL); | 296 expectIntegrityFailure(kUnsupportedHashFunctionIntegrity, kBasicScript, secu
reURL); |
297 } | 297 } |
298 | 298 |
299 } // namespace blink | 299 } // namespace blink |
OLD | NEW |