OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/content_subresource_filt er_driver_factory.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 {ActivationDecision::ACTIVATION_DISABLED, ActivationLevel::DISABLED}, | 182 {ActivationDecision::ACTIVATION_DISABLED, ActivationLevel::DISABLED}, |
183 }; | 183 }; |
184 | 184 |
185 class MockSubresourceFilterClient : public SubresourceFilterClient { | 185 class MockSubresourceFilterClient : public SubresourceFilterClient { |
186 public: | 186 public: |
187 MockSubresourceFilterClient(VerifiedRulesetDealer::Handle* ruleset_dealer) | 187 MockSubresourceFilterClient(VerifiedRulesetDealer::Handle* ruleset_dealer) |
188 : ruleset_dealer_(ruleset_dealer) {} | 188 : ruleset_dealer_(ruleset_dealer) {} |
189 | 189 |
190 ~MockSubresourceFilterClient() override = default; | 190 ~MockSubresourceFilterClient() override = default; |
191 | 191 |
192 bool ShouldSuppressActivation(content::NavigationHandle* handle) override { | 192 bool OnPageActivationComputed(content::NavigationHandle* handle, |
193 return handle->IsInMainFrame() && | 193 bool activated) override { |
194 whitelisted_hosts_.find(handle->GetURL().host()) != | 194 DCHECK(handle->IsInMainFrame()); |
195 whitelisted_hosts_.end(); | 195 return activated && whitelisted_hosts_.find(handle->GetURL().host()) != |
196 whitelisted_hosts_.end(); | |
shivanisha
2017/05/10 18:43:18
Did you mean to move back to count()?
Charlie Harrison
2017/05/10 18:55:21
Oh, I just forgot to update the test only implemen
Charlie Harrison
2017/05/10 18:57:32
Done. OK landing now :)
| |
196 } | 197 } |
197 | 198 |
198 void WhitelistByContentSettings(const GURL& url) override {} | 199 void WhitelistByContentSettings(const GURL& url) override {} |
199 void WhitelistInCurrentWebContents(const GURL& url) override { | 200 void WhitelistInCurrentWebContents(const GURL& url) override { |
200 if (url.SchemeIsHTTPOrHTTPS()) | 201 if (url.SchemeIsHTTPOrHTTPS()) |
201 whitelisted_hosts_.insert(url.host()); | 202 whitelisted_hosts_.insert(url.host()); |
202 } | 203 } |
203 | 204 |
204 VerifiedRulesetDealer::Handle* GetRulesetDealer() override { | 205 VerifiedRulesetDealer::Handle* GetRulesetDealer() override { |
205 return ruleset_dealer_; | 206 return ruleset_dealer_; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 ActivationScopeTest, | 892 ActivationScopeTest, |
892 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 893 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
893 ::testing::ValuesIn(kActivationScopeTestData)); | 894 ::testing::ValuesIn(kActivationScopeTestData)); |
894 | 895 |
895 INSTANTIATE_TEST_CASE_P( | 896 INSTANTIATE_TEST_CASE_P( |
896 ActivationLevelTest, | 897 ActivationLevelTest, |
897 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 898 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
898 ::testing::ValuesIn(kActivationLevelTestData)); | 899 ::testing::ValuesIn(kActivationLevelTestData)); |
899 | 900 |
900 } // namespace subresource_filter | 901 } // namespace subresource_filter |
OLD | NEW |