| 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 "core/loader/MixedContentChecker.h" | 5 #include "core/loader/MixedContentChecker.h" |
| 6 | 6 |
| 7 #include "core/loader/EmptyClients.h" | 7 #include "core/loader/EmptyClients.h" |
| 8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
| 9 #include "platform/network/ResourceResponse.h" | 9 #include "platform/network/ResourceResponse.h" |
| 10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 {"http://example.com/foo", "http://example.com/foo", false}, | 26 {"http://example.com/foo", "http://example.com/foo", false}, |
| 27 {"http://example.com/foo", "https://example.com/foo", false}, | 27 {"http://example.com/foo", "https://example.com/foo", false}, |
| 28 {"https://example.com/foo", "https://example.com/foo", false}, | 28 {"https://example.com/foo", "https://example.com/foo", false}, |
| 29 {"https://example.com/foo", "wss://example.com/foo", false}, | 29 {"https://example.com/foo", "wss://example.com/foo", false}, |
| 30 {"https://example.com/foo", "http://example.com/foo", true}, | 30 {"https://example.com/foo", "http://example.com/foo", true}, |
| 31 {"https://example.com/foo", "http://google.com/foo", true}, | 31 {"https://example.com/foo", "http://google.com/foo", true}, |
| 32 {"https://example.com/foo", "ws://example.com/foo", true}, | 32 {"https://example.com/foo", "ws://example.com/foo", true}, |
| 33 {"https://example.com/foo", "ws://google.com/foo", true}, | 33 {"https://example.com/foo", "ws://google.com/foo", true}, |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 for (size_t i = 0; i < arraysize(cases); ++i) { | 36 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); ++i) { |
| 37 const char* origin = cases[i].origin; | 37 const char* origin = cases[i].origin; |
| 38 const char* target = cases[i].target; | 38 const char* target = cases[i].target; |
| 39 bool expectation = cases[i].expectation; | 39 bool expectation = cases[i].expectation; |
| 40 | 40 |
| 41 KURL originUrl(KURL(), origin); | 41 KURL originUrl(KURL(), origin); |
| 42 RefPtr<SecurityOrigin> securityOrigin(SecurityOrigin::create(originUrl))
; | 42 RefPtr<SecurityOrigin> securityOrigin(SecurityOrigin::create(originUrl))
; |
| 43 KURL targetUrl(KURL(), target); | 43 KURL targetUrl(KURL(), target); |
| 44 EXPECT_EQ(expectation, MixedContentChecker::isMixedContent(securityOrigi
n.get(), targetUrl)) << "Origin: " << origin << ", Target: " << target << ", Exp
ectation: " << expectation; | 44 EXPECT_EQ(expectation, MixedContentChecker::isMixedContent(securityOrigi
n.get(), targetUrl)) << "Origin: " << origin << ", Target: " << target << ", Exp
ectation: " << expectation; |
| 45 } | 45 } |
| 46 } | 46 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 request2.setFrameType(WebURLRequest::FrameTypeNone); | 107 request2.setFrameType(WebURLRequest::FrameTypeNone); |
| 108 ResourceResponse response2; | 108 ResourceResponse response2; |
| 109 ASSERT_EQ(MixedContentChecker::ContextTypeOptionallyBlockable, MixedContentC
hecker::contextTypeFromContext(request2.requestContext(), &dummyPageHolder->fram
e())); | 109 ASSERT_EQ(MixedContentChecker::ContextTypeOptionallyBlockable, MixedContentC
hecker::contextTypeFromContext(request2.requestContext(), &dummyPageHolder->fram
e())); |
| 110 response2.setURL(displayedUrl); | 110 response2.setURL(displayedUrl); |
| 111 response2.setSecurityInfo("security info2"); | 111 response2.setSecurityInfo("security info2"); |
| 112 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl, re
sponse2.getSecurityInfo(), WebURL(mainResourceUrl), CString())); | 112 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl, re
sponse2.getSecurityInfo(), WebURL(mainResourceUrl), CString())); |
| 113 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), reque
st2, response2); | 113 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), reque
st2, response2); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |