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

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

Issue 2844063002: Add support for multiple simultaneous subresource_filter::Configurations. (Closed)
Patch Set: Polish + rebase. Created 3 years, 7 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 EXPECT_TRUE(ShowingInterstitialPage()); 901 EXPECT_TRUE(ShowingInterstitialPage());
902 EXPECT_TRUE(got_hit_report()); 902 EXPECT_TRUE(got_hit_report());
903 EXPECT_EQ(bad_url, hit_report().malicious_url); 903 EXPECT_EQ(bad_url, hit_report().malicious_url);
904 EXPECT_EQ(bad_url, hit_report().page_url); 904 EXPECT_EQ(bad_url, hit_report().page_url);
905 EXPECT_EQ(first_url, hit_report().referrer_url); 905 EXPECT_EQ(first_url, hit_report().referrer_url);
906 EXPECT_FALSE(hit_report().is_subresource); 906 EXPECT_FALSE(hit_report().is_subresource);
907 } 907 }
908 908
909 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) { 909 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) {
910 subresource_filter::testing::ScopedSubresourceFilterConfigurator 910 subresource_filter::testing::ScopedSubresourceFilterConfigurator
911 scoped_configuration(subresource_filter::Configuration( 911 scoped_configuration(subresource_filter::Configuration::
912 subresource_filter::ActivationLevel::ENABLED, 912 MakePresetForLiveRunOnPhishingSites());
Charlie Harrison 2017/05/03 14:52:17 Ahh, much better :D
engedy 2017/05/05 12:25:41 :-)
913 subresource_filter::ActivationScope::ACTIVATION_LIST,
914 subresource_filter::ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL));
915 913
916 subresource_filter::testing::TestRulesetCreator ruleset_creator; 914 subresource_filter::testing::TestRulesetCreator ruleset_creator;
917 subresource_filter::testing::TestRulesetPair test_ruleset_pair; 915 subresource_filter::testing::TestRulesetPair test_ruleset_pair;
918 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( 916 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix(
919 "included_script.js", &test_ruleset_pair); 917 "included_script.js", &test_ruleset_pair);
920 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; 918 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher;
921 ASSERT_NO_FATAL_FAILURE( 919 ASSERT_NO_FATAL_FAILURE(
922 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); 920 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed));
923 921
924 GURL phishing_url = embedded_test_server()->GetURL( 922 GURL phishing_url = embedded_test_server()->GetURL(
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 EXPECT_TRUE(got_hit_report()); 1975 EXPECT_TRUE(got_hit_report());
1978 EXPECT_EQ(bad_url, hit_report().malicious_url); 1976 EXPECT_EQ(bad_url, hit_report().malicious_url);
1979 EXPECT_EQ(bad_url, hit_report().page_url); 1977 EXPECT_EQ(bad_url, hit_report().page_url);
1980 EXPECT_EQ(first_url, hit_report().referrer_url); 1978 EXPECT_EQ(first_url, hit_report().referrer_url);
1981 EXPECT_FALSE(hit_report().is_subresource); 1979 EXPECT_FALSE(hit_report().is_subresource);
1982 } 1980 }
1983 1981
1984 IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, 1982 IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest,
1985 SubresourceFilterEndToEndTest) { 1983 SubresourceFilterEndToEndTest) {
1986 subresource_filter::testing::ScopedSubresourceFilterConfigurator 1984 subresource_filter::testing::ScopedSubresourceFilterConfigurator
1987 scoped_configuration(subresource_filter::Configuration( 1985 scoped_configuration(subresource_filter::Configuration::
1988 subresource_filter::ActivationLevel::ENABLED, 1986 MakePresetForLiveRunOnPhishingSites());
1989 subresource_filter::ActivationScope::ACTIVATION_LIST,
1990 subresource_filter::ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL));
1991 1987
1992 subresource_filter::testing::TestRulesetCreator ruleset_creator; 1988 subresource_filter::testing::TestRulesetCreator ruleset_creator;
1993 subresource_filter::testing::TestRulesetPair test_ruleset_pair; 1989 subresource_filter::testing::TestRulesetPair test_ruleset_pair;
1994 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( 1990 ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix(
1995 "included_script.js", &test_ruleset_pair); 1991 "included_script.js", &test_ruleset_pair);
1996 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; 1992 subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher;
1997 ASSERT_NO_FATAL_FAILURE( 1993 ASSERT_NO_FATAL_FAILURE(
1998 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); 1994 test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed));
1999 1995
2000 GURL phishing_url = embedded_test_server()->GetURL( 1996 GURL phishing_url = embedded_test_server()->GetURL(
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 } 2490 }
2495 2491
2496 INSTANTIATE_TEST_CASE_P( 2492 INSTANTIATE_TEST_CASE_P(
2497 MaybeSetMetadata, 2493 MaybeSetMetadata,
2498 V4SafeBrowsingServiceMetadataTest, 2494 V4SafeBrowsingServiceMetadataTest,
2499 testing::Values(ThreatPatternType::NONE, 2495 testing::Values(ThreatPatternType::NONE,
2500 ThreatPatternType::MALWARE_LANDING, 2496 ThreatPatternType::MALWARE_LANDING,
2501 ThreatPatternType::MALWARE_DISTRIBUTION)); 2497 ThreatPatternType::MALWARE_DISTRIBUTION));
2502 2498
2503 } // namespace safe_browsing 2499 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698