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