| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( | 726 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( |
| 727 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, | 727 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, |
| 728 test_data.activation_scope, | 728 test_data.activation_scope, |
| 729 kActivationListSocialEngineeringAdsInterstitial); | 729 kActivationListSocialEngineeringAdsInterstitial); |
| 730 | 730 |
| 731 const char* unsupported_urls[] = { | 731 const char* unsupported_urls[] = { |
| 732 "data:text/html,<p>Hello", "ftp://example.com/", "chrome://settings", | 732 "data:text/html,<p>Hello", "ftp://example.com/", "chrome://settings", |
| 733 "chrome-extension://some-extension", "file:///var/www/index.html"}; | 733 "chrome-extension://some-extension", "file:///var/www/index.html"}; |
| 734 const char* supported_urls[] = {"http://example.test", | 734 const char* supported_urls[] = {"http://example.test", |
| 735 "https://example.test"}; | 735 "https://example.test"}; |
| 736 for (const auto url : unsupported_urls) { | 736 for (auto* url : unsupported_urls) { |
| 737 SCOPED_TRACE(url); | 737 SCOPED_TRACE(url); |
| 738 RedirectChainMatchPattern expected_pattern = EMPTY; | 738 RedirectChainMatchPattern expected_pattern = EMPTY; |
| 739 NavigateAndExpectActivation( | 739 NavigateAndExpectActivation( |
| 740 {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern, | 740 {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern, |
| 741 GetCurrentActivationScope() == ActivationScope::NO_SITES | 741 GetCurrentActivationScope() == ActivationScope::NO_SITES |
| 742 ? ActivationDecision::ACTIVATION_DISABLED | 742 ? ActivationDecision::ACTIVATION_DISABLED |
| 743 : ActivationDecision::UNSUPPORTED_SCHEME); | 743 : ActivationDecision::UNSUPPORTED_SCHEME); |
| 744 } | 744 } |
| 745 for (const auto url : supported_urls) { | 745 for (auto* url : supported_urls) { |
| 746 SCOPED_TRACE(url); | 746 SCOPED_TRACE(url); |
| 747 RedirectChainMatchPattern expected_pattern = | 747 RedirectChainMatchPattern expected_pattern = |
| 748 test_data.url_matches_activation_list ? NO_REDIRECTS_HIT : EMPTY; | 748 test_data.url_matches_activation_list ? NO_REDIRECTS_HIT : EMPTY; |
| 749 NavigateAndExpectActivation({test_data.url_matches_activation_list}, | 749 NavigateAndExpectActivation({test_data.url_matches_activation_list}, |
| 750 {GURL(url)}, expected_pattern, | 750 {GURL(url)}, expected_pattern, |
| 751 test_data.expected_activation_decision); | 751 test_data.expected_activation_decision); |
| 752 } | 752 } |
| 753 }; | 753 }; |
| 754 | 754 |
| 755 INSTANTIATE_TEST_CASE_P(NoSocEngHit, | 755 INSTANTIATE_TEST_CASE_P(NoSocEngHit, |
| 756 ContentSubresourceFilterDriverFactoryThreatTypeTest, | 756 ContentSubresourceFilterDriverFactoryThreatTypeTest, |
| 757 ::testing::ValuesIn(kActivationListTestData)); | 757 ::testing::ValuesIn(kActivationListTestData)); |
| 758 | 758 |
| 759 INSTANTIATE_TEST_CASE_P( | 759 INSTANTIATE_TEST_CASE_P( |
| 760 ActivationScopeTest, | 760 ActivationScopeTest, |
| 761 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 761 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
| 762 ::testing::ValuesIn(kActivationScopeTestData)); | 762 ::testing::ValuesIn(kActivationScopeTestData)); |
| 763 | 763 |
| 764 INSTANTIATE_TEST_CASE_P( | 764 INSTANTIATE_TEST_CASE_P( |
| 765 ActivationLevelTest, | 765 ActivationLevelTest, |
| 766 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 766 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
| 767 ::testing::ValuesIn(kActivationLevelTestData)); | 767 ::testing::ValuesIn(kActivationLevelTestData)); |
| 768 | 768 |
| 769 } // namespace subresource_filter | 769 } // namespace subresource_filter |
| OLD | NEW |