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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |