| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 { | 119 { |
| 120 scriptElement->setAttribute(HTMLNames::integrityAttr, integrity); | 120 scriptElement->setAttribute(HTMLNames::integrityAttr, integrity); |
| 121 EXPECT_FALSE(SubresourceIntegrity::CheckSubresourceIntegrity(*scriptElem
ent, script, url)); | 121 EXPECT_FALSE(SubresourceIntegrity::CheckSubresourceIntegrity(*scriptElem
ent, script, url)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 KURL secureURL; | 124 KURL secureURL; |
| 125 KURL insecureURL; | 125 KURL insecureURL; |
| 126 RefPtr<SecurityOrigin> secureOrigin; | 126 RefPtr<SecurityOrigin> secureOrigin; |
| 127 RefPtr<SecurityOrigin> insecureOrigin; | 127 RefPtr<SecurityOrigin> insecureOrigin; |
| 128 | 128 |
| 129 RefPtrWillBeRawPtr<Document> document; | 129 RefPtrWillBePersistent<Document> document; |
| 130 RefPtrWillBeRawPtr<HTMLScriptElement> scriptElement; | 130 RefPtrWillBePersistent<HTMLScriptElement> scriptElement; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 TEST_F(SubresourceIntegrityTest, ParseAlgorithm) | 133 TEST_F(SubresourceIntegrityTest, ParseAlgorithm) |
| 134 { | 134 { |
| 135 expectAlgorithm("sha256;", HashAlgorithmSha256); | 135 expectAlgorithm("sha256;", HashAlgorithmSha256); |
| 136 expectAlgorithm("sha384;", HashAlgorithmSha384); | 136 expectAlgorithm("sha384;", HashAlgorithmSha384); |
| 137 expectAlgorithm("sha512;", HashAlgorithmSha512); | 137 expectAlgorithm("sha512;", HashAlgorithmSha512); |
| 138 | 138 |
| 139 expectAlgorithmFailure("sha1;"); | 139 expectAlgorithmFailure("sha1;"); |
| 140 expectAlgorithmFailure("sha-1;"); | 140 expectAlgorithmFailure("sha-1;"); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 document->updateSecurityOrigin(insecureOrigin->isolatedCopy()); | 214 document->updateSecurityOrigin(insecureOrigin->isolatedCopy()); |
| 215 | 215 |
| 216 expectIntegrityFailure(kSha256Integrity, kBasicScript, secureURL); | 216 expectIntegrityFailure(kSha256Integrity, kBasicScript, secureURL); |
| 217 expectIntegrityFailure(kSha384Integrity, kBasicScript, secureURL); | 217 expectIntegrityFailure(kSha384Integrity, kBasicScript, secureURL); |
| 218 expectIntegrityFailure(kSha512Integrity, kBasicScript, secureURL); | 218 expectIntegrityFailure(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 |