Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc

Issue 2838193002: Split the ScopedSubresourceFilterFeatureToggle into two helper classes. (Closed)
Patch Set: More polish. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This test creates a safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
10 10
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 EXPECT_TRUE(ShowingInterstitialPage()); 898 EXPECT_TRUE(ShowingInterstitialPage());
899 EXPECT_TRUE(got_hit_report()); 899 EXPECT_TRUE(got_hit_report());
900 EXPECT_EQ(bad_url, hit_report().malicious_url); 900 EXPECT_EQ(bad_url, hit_report().malicious_url);
901 EXPECT_EQ(bad_url, hit_report().page_url); 901 EXPECT_EQ(bad_url, hit_report().page_url);
902 EXPECT_EQ(first_url, hit_report().referrer_url); 902 EXPECT_EQ(first_url, hit_report().referrer_url);
903 EXPECT_FALSE(hit_report().is_subresource); 903 EXPECT_FALSE(hit_report().is_subresource);
904 } 904 }
905 905
906 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) { 906 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) {
907 subresource_filter::testing::ScopedSubresourceFilterFeatureToggle 907 subresource_filter::testing::ScopedSubresourceFilterConfigurator
908 scoped_feature_toggle( 908 scoped_configuration(subresource_filter::Configuration(
909 base::FeatureList::OVERRIDE_ENABLE_FEATURE, 909 subresource_filter::ActivationLevel::ENABLED,
Charlie Harrison 2017/04/25 19:36:21 #include activation_{scope,level,list}
engedy 2017/04/25 20:13:24 Done.
910 subresource_filter::kActivationLevelEnabled, 910 subresource_filter::ActivationScope::ACTIVATION_LIST,
911 subresource_filter::kActivationScopeActivationList, 911 subresource_filter::ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL));
912 subresource_filter::kActivationListSocialEngineeringAdsInterstitial);
913 912
914 subresource_filter::testing::TestRulesetCreator ruleset_creator; 913 subresource_filter::testing::TestRulesetCreator ruleset_creator;
915 subresource_filter::testing::TestRulesetPair test_ruleset_pair; 914 subresource_filter::testing::TestRulesetPair test_ruleset_pair;
916 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( 915 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix(
917 "included_script.js", &test_ruleset_pair); 916 "included_script.js", &test_ruleset_pair);
918 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; 917 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher;
919 ASSERT_NO_FATAL_FAILURE( 918 ASSERT_NO_FATAL_FAILURE(
920 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); 919 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed));
921 920
922 GURL phishing_url = embedded_test_server()->GetURL( 921 GURL phishing_url = embedded_test_server()->GetURL(
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 EXPECT_TRUE(ShowingInterstitialPage()); 1969 EXPECT_TRUE(ShowingInterstitialPage());
1971 EXPECT_TRUE(got_hit_report()); 1970 EXPECT_TRUE(got_hit_report());
1972 EXPECT_EQ(bad_url, hit_report().malicious_url); 1971 EXPECT_EQ(bad_url, hit_report().malicious_url);
1973 EXPECT_EQ(bad_url, hit_report().page_url); 1972 EXPECT_EQ(bad_url, hit_report().page_url);
1974 EXPECT_EQ(first_url, hit_report().referrer_url); 1973 EXPECT_EQ(first_url, hit_report().referrer_url);
1975 EXPECT_FALSE(hit_report().is_subresource); 1974 EXPECT_FALSE(hit_report().is_subresource);
1976 } 1975 }
1977 1976
1978 IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, 1977 IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest,
1979 SubresourceFilterEndToEndTest) { 1978 SubresourceFilterEndToEndTest) {
1980 subresource_filter::testing::ScopedSubresourceFilterFeatureToggle 1979 subresource_filter::testing::ScopedSubresourceFilterConfigurator
1981 scoped_feature_toggle( 1980 scoped_configuration(subresource_filter::Configuration(
1982 base::FeatureList::OVERRIDE_ENABLE_FEATURE, 1981 subresource_filter::ActivationLevel::ENABLED,
1983 subresource_filter::kActivationLevelEnabled, 1982 subresource_filter::ActivationScope::ACTIVATION_LIST,
1984 subresource_filter::kActivationScopeActivationList, 1983 subresource_filter::ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL));
1985 subresource_filter::kActivationListSocialEngineeringAdsInterstitial);
1986 1984
1987 subresource_filter::testing::TestRulesetCreator ruleset_creator; 1985 subresource_filter::testing::TestRulesetCreator ruleset_creator;
1988 subresource_filter::testing::TestRulesetPair test_ruleset_pair; 1986 subresource_filter::testing::TestRulesetPair test_ruleset_pair;
1989 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( 1987 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix(
1990 "included_script.js", &test_ruleset_pair); 1988 "included_script.js", &test_ruleset_pair);
1991 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; 1989 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher;
1992 ASSERT_NO_FATAL_FAILURE( 1990 ASSERT_NO_FATAL_FAILURE(
1993 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); 1991 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed));
1994 1992
1995 GURL phishing_url = embedded_test_server()->GetURL( 1993 GURL phishing_url = embedded_test_server()->GetURL(
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 } 2487 }
2490 2488
2491 INSTANTIATE_TEST_CASE_P( 2489 INSTANTIATE_TEST_CASE_P(
2492 MaybeSetMetadata, 2490 MaybeSetMetadata,
2493 V4SafeBrowsingServiceMetadataTest, 2491 V4SafeBrowsingServiceMetadataTest,
2494 testing::Values(ThreatPatternType::NONE, 2492 testing::Values(ThreatPatternType::NONE,
2495 ThreatPatternType::MALWARE_LANDING, 2493 ThreatPatternType::MALWARE_LANDING,
2496 ThreatPatternType::MALWARE_DISTRIBUTION)); 2494 ThreatPatternType::MALWARE_DISTRIBUTION));
2497 2495
2498 } // namespace safe_browsing 2496 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698