| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/subresource_filter/content/browser/subframe_navigation_filt
ering_throttle.h" | 5 #include "components/subresource_filter/content/browser/subframe_navigation_filt
ering_throttle.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 testing::TestRuleset::Open(test_ruleset_pair_.indexed)); | 72 testing::TestRuleset::Open(test_ruleset_pair_.indexed)); |
| 73 ruleset_handle_ = | 73 ruleset_handle_ = |
| 74 base::MakeUnique<VerifiedRuleset::Handle>(dealer_handle_.get()); | 74 base::MakeUnique<VerifiedRuleset::Handle>(dealer_handle_.get()); |
| 75 | 75 |
| 76 testing::TestActivationStateCallbackReceiver activation_state; | 76 testing::TestActivationStateCallbackReceiver activation_state; |
| 77 parent_filter_ = base::MakeUnique<AsyncDocumentSubresourceFilter>( | 77 parent_filter_ = base::MakeUnique<AsyncDocumentSubresourceFilter>( |
| 78 ruleset_handle_.get(), | 78 ruleset_handle_.get(), |
| 79 AsyncDocumentSubresourceFilter::InitializationParams( | 79 AsyncDocumentSubresourceFilter::InitializationParams( |
| 80 document_url, ActivationLevel::ENABLED, | 80 document_url, ActivationLevel::ENABLED, |
| 81 false /* measure_performance */), | 81 false /* measure_performance */), |
| 82 activation_state.GetCallback(), base::OnceClosure()); | 82 activation_state.GetCallback()); |
| 83 RunUntilIdle(); | 83 RunUntilIdle(); |
| 84 activation_state.ExpectReceivedOnce( | 84 activation_state.ExpectReceivedOnce( |
| 85 ActivationState(ActivationLevel::ENABLED)); | 85 ActivationState(ActivationLevel::ENABLED)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } | 88 void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } |
| 89 | 89 |
| 90 void CreateTestSubframeAndInitNavigation(const GURL& first_url, | 90 void CreateTestSubframeAndInitNavigation(const GURL& first_url, |
| 91 content::RenderFrameHost* parent) { | 91 content::RenderFrameHost* parent) { |
| 92 content::RenderFrameHost* render_frame = | 92 content::RenderFrameHost* render_frame = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 InitializeDocumentSubresourceFilter(GURL("https://example.test")); | 184 InitializeDocumentSubresourceFilter(GURL("https://example.test")); |
| 185 content::RenderFrameHostTester::For(parent_subframe) | 185 content::RenderFrameHostTester::For(parent_subframe) |
| 186 ->SimulateNavigationCommit(test_url); | 186 ->SimulateNavigationCommit(test_url); |
| 187 | 187 |
| 188 CreateTestSubframeAndInitNavigation( | 188 CreateTestSubframeAndInitNavigation( |
| 189 GURL("https://example.test/disallowed.html"), parent_subframe); | 189 GURL("https://example.test/disallowed.html"), parent_subframe); |
| 190 SimulateStartAndExpectResult(content::NavigationThrottle::CANCEL); | 190 SimulateStartAndExpectResult(content::NavigationThrottle::CANCEL); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace subresource_filter | 193 } // namespace subresource_filter |
| OLD | NEW |