| 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 <base/macros.h> | 7 #include <base/macros.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/loader/EmptyClients.h" | 10 #include "core/loader/EmptyClients.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 {"https://example.com/foo", "http://example.com/foo", true}, | 49 {"https://example.com/foo", "http://example.com/foo", true}, |
| 50 {"https://example.com/foo", "http://google.com/foo", true}, | 50 {"https://example.com/foo", "http://google.com/foo", true}, |
| 51 {"https://example.com/foo", "ws://example.com/foo", true}, | 51 {"https://example.com/foo", "ws://example.com/foo", true}, |
| 52 {"https://example.com/foo", "ws://google.com/foo", true}, | 52 {"https://example.com/foo", "ws://google.com/foo", true}, |
| 53 {"https://example.com/foo", "http://192.168.1.1/", true}, | 53 {"https://example.com/foo", "http://192.168.1.1/", true}, |
| 54 {"https://example.com/foo", "http://localhost/", true}, | 54 {"https://example.com/foo", "http://localhost/", true}, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 for (const auto& test : cases) { | 57 for (const auto& test : cases) { |
| 58 SCOPED_TRACE(::testing::Message() << "Origin: " << test.origin | 58 SCOPED_TRACE(::testing::Message() |
| 59 << ", Target: " << test.target | 59 << "Origin: " << test.origin << ", Target: " << test.target |
| 60 << ", Expectation: " << test.expectation); | 60 << ", Expectation: " << test.expectation); |
| 61 KURL origin_url(KURL(), test.origin); | 61 KURL origin_url(KURL(), test.origin); |
| 62 RefPtr<SecurityOrigin> security_origin(SecurityOrigin::Create(origin_url)); | 62 RefPtr<SecurityOrigin> security_origin(SecurityOrigin::Create(origin_url)); |
| 63 KURL target_url(KURL(), test.target); | 63 KURL target_url(KURL(), test.target); |
| 64 EXPECT_EQ(test.expectation, MixedContentChecker::IsMixedContent( | 64 EXPECT_EQ(test.expectation, MixedContentChecker::IsMixedContent( |
| 65 security_origin.Get(), target_url)); | 65 security_origin.Get(), target_url)); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST(MixedContentCheckerTest, ContextTypeForInspector) { | 69 TEST(MixedContentCheckerTest, ContextTypeForInspector) { |
| 70 std::unique_ptr<DummyPageHolder> dummy_page_holder = | 70 std::unique_ptr<DummyPageHolder> dummy_page_holder = |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 SecurityViolationReportingPolicy::kSuppressReporting)); | 174 SecurityViolationReportingPolicy::kSuppressReporting)); |
| 175 EXPECT_FALSE(MixedContentChecker::IsMixedFormAction( | 175 EXPECT_FALSE(MixedContentChecker::IsMixedFormAction( |
| 176 &dummy_page_holder->GetFrame(), javascript_form_action_url, | 176 &dummy_page_holder->GetFrame(), javascript_form_action_url, |
| 177 SecurityViolationReportingPolicy::kSuppressReporting)); | 177 SecurityViolationReportingPolicy::kSuppressReporting)); |
| 178 EXPECT_TRUE(MixedContentChecker::IsMixedFormAction( | 178 EXPECT_TRUE(MixedContentChecker::IsMixedFormAction( |
| 179 &dummy_page_holder->GetFrame(), mailto_form_action_url, | 179 &dummy_page_holder->GetFrame(), mailto_form_action_url, |
| 180 SecurityViolationReportingPolicy::kSuppressReporting)); | 180 SecurityViolationReportingPolicy::kSuppressReporting)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |