| 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 // activation scope is for all sites. | 739 // activation scope is for all sites. |
| 740 TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest, | 740 TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest, |
| 741 ActivateForSupportedUrlScheme) { | 741 ActivateForSupportedUrlScheme) { |
| 742 const ActivationScopeTestData& test_data = GetParam(); | 742 const ActivationScopeTestData& test_data = GetParam(); |
| 743 base::FieldTrialList field_trial_list(nullptr); | 743 base::FieldTrialList field_trial_list(nullptr); |
| 744 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( | 744 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( |
| 745 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, | 745 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, |
| 746 test_data.activation_scope, | 746 test_data.activation_scope, |
| 747 kActivationListSocialEngineeringAdsInterstitial); | 747 kActivationListSocialEngineeringAdsInterstitial); |
| 748 | 748 |
| 749 const char* unsupported_urls[] = { | 749 // data URLs are also not supported, but not listed here, as it's not possible |
| 750 "data:text/html,<p>Hello", "ftp://example.com/", "chrome://settings", | 750 // for a page to redirect to them after https://crbug.com/594215 is fixed. |
| 751 "chrome-extension://some-extension", "file:///var/www/index.html"}; | 751 const char* unsupported_urls[] = {"ftp://example.com/", "chrome://settings", |
| 752 "chrome-extension://some-extension", |
| 753 "file:///var/www/index.html"}; |
| 752 const char* supported_urls[] = {"http://example.test", | 754 const char* supported_urls[] = {"http://example.test", |
| 753 "https://example.test"}; | 755 "https://example.test"}; |
| 754 for (auto* url : unsupported_urls) { | 756 for (auto* url : unsupported_urls) { |
| 755 SCOPED_TRACE(url); | 757 SCOPED_TRACE(url); |
| 756 RedirectChainMatchPattern expected_pattern = EMPTY; | 758 RedirectChainMatchPattern expected_pattern = EMPTY; |
| 757 NavigateAndExpectActivation( | 759 NavigateAndExpectActivation( |
| 758 {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern, | 760 {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern, |
| 759 GetCurrentActivationScope() == ActivationScope::NO_SITES | 761 GetCurrentActivationScope() == ActivationScope::NO_SITES |
| 760 ? ActivationDecision::ACTIVATION_DISABLED | 762 ? ActivationDecision::ACTIVATION_DISABLED |
| 761 : ActivationDecision::UNSUPPORTED_SCHEME); | 763 : ActivationDecision::UNSUPPORTED_SCHEME); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 778 ActivationScopeTest, | 780 ActivationScopeTest, |
| 779 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 781 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
| 780 ::testing::ValuesIn(kActivationScopeTestData)); | 782 ::testing::ValuesIn(kActivationScopeTestData)); |
| 781 | 783 |
| 782 INSTANTIATE_TEST_CASE_P( | 784 INSTANTIATE_TEST_CASE_P( |
| 783 ActivationLevelTest, | 785 ActivationLevelTest, |
| 784 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 786 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
| 785 ::testing::ValuesIn(kActivationLevelTestData)); | 787 ::testing::ValuesIn(kActivationLevelTestData)); |
| 786 | 788 |
| 787 } // namespace subresource_filter | 789 } // namespace subresource_filter |
| OLD | NEW |