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/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
8 #include "core/loader/EmptyClients.h" | 8 #include "core/loader/EmptyClients.h" |
9 #include "core/testing/DummyPageHolder.h" | 9 #include "core/testing/DummyPageHolder.h" |
10 #include "platform/network/ResourceResponse.h" | 10 #include "platform/network/ResourceResponse.h" |
11 #include "platform/weborigin/KURL.h" | 11 #include "platform/weborigin/KURL.h" |
12 #include "platform/weborigin/SecurityOrigin.h" | 12 #include "platform/weborigin/SecurityOrigin.h" |
13 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" | 13 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "wtf/RefPtr.h" | 15 #include "wtf/RefPtr.h" |
16 #include <base/macros.h> | 16 #include <base/macros.h> |
17 #include <memory> | 17 #include <memory> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
| 21 // Tests that MixedContentChecker::isMixedContent correctly detects or ignores |
| 22 // many cases where there is or there is not mixed content, respectively. |
| 23 // Note: Renderer side version of |
| 24 // MixedContentNavigationThrottleTest.IsMixedContent. Must be kept in sync |
| 25 // manually! |
21 TEST(MixedContentCheckerTest, IsMixedContent) { | 26 TEST(MixedContentCheckerTest, IsMixedContent) { |
22 struct TestCase { | 27 struct TestCase { |
23 const char* origin; | 28 const char* origin; |
24 const char* target; | 29 const char* target; |
25 bool expectation; | 30 bool expectation; |
26 } cases[] = { | 31 } cases[] = { |
27 {"http://example.com/foo", "http://example.com/foo", false}, | 32 {"http://example.com/foo", "http://example.com/foo", false}, |
28 {"http://example.com/foo", "https://example.com/foo", false}, | 33 {"http://example.com/foo", "https://example.com/foo", false}, |
29 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false}, | 34 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false}, |
30 {"http://example.com/foo", "about:blank", false}, | 35 {"http://example.com/foo", "about:blank", false}, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 .settings() | 137 .settings() |
133 ->getStrictMixedContentCheckingForPlugin())); | 138 ->getStrictMixedContentCheckingForPlugin())); |
134 response2.setURL(displayedUrl); | 139 response2.setURL(displayedUrl); |
135 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl)); | 140 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl)); |
136 MixedContentChecker::handleCertificateError( | 141 MixedContentChecker::handleCertificateError( |
137 &dummyPageHolder->frame(), response2, WebURLRequest::FrameTypeNone, | 142 &dummyPageHolder->frame(), response2, WebURLRequest::FrameTypeNone, |
138 requestContext); | 143 requestContext); |
139 } | 144 } |
140 | 145 |
141 } // namespace blink | 146 } // namespace blink |
OLD | NEW |