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

Unified Diff: chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc

Issue 2248403002: Implement origin-based deletion of plugin data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browsing_data/registrable_domain_filter_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc
diff --git a/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc b/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc
index b56dbcca1bc98c6db93d15fff2d5ab6e1fd7f187..edc11aa95c44eeb91a713f98b68706d7f15ff19e 100644
--- a/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc
+++ b/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc
@@ -497,3 +497,71 @@ TEST(RegistrableDomainFilterBuilderTest, MatchesChannelIDsBlacklist) {
for (TestCase test_case : test_cases)
RunTestCase(test_case, filter);
}
+
+TEST(RegistrableDomainFilterBuilderTest, MatchesPluginSitesWhitelist) {
+ RegistrableDomainFilterBuilder builder(
+ RegistrableDomainFilterBuilder::WHITELIST);
+ builder.AddRegisterableDomain(std::string(kGoogleDomain));
+ builder.AddRegisterableDomain(std::string(kLongETLDDomain));
+ builder.AddRegisterableDomain(std::string(kIPAddress));
+ builder.AddRegisterableDomain(std::string(kUnknownRegistryDomain));
+ builder.AddRegisterableDomain(std::string(kInternalHostname));
+ base::Callback<bool(const std::string&)> filter =
+ builder.BuildPluginFilter();
+
+ TestCase test_cases[] = {
+ // Plugin sites can be domains, ...
+ {"google.com", true},
+ {"www.google.com", true},
+ {"website.sp.nom.br", true},
+ {"www.website.sp.nom.br", true},
+ {"second-level-domain.fileserver", true},
+ {"foo.bar.second-level-domain.fileserver", true},
+
+ // ... IP addresses, or internal hostnames.
+ {"192.168.1.1", true},
+ {"fileserver", true},
+
+ // Sites not in the whitelist are not matched.
+ {"example.com", false},
+ {"192.168.1.2", false},
+ {"website.fileserver", false},
+ };
+
+ for (TestCase test_case : test_cases)
+ RunTestCase(test_case, filter);
+}
+
+TEST(RegistrableDomainFilterBuilderTest, MatchesPluginSitesBlacklist) {
+ RegistrableDomainFilterBuilder builder(
+ RegistrableDomainFilterBuilder::BLACKLIST);
+ builder.AddRegisterableDomain(std::string(kGoogleDomain));
+ builder.AddRegisterableDomain(std::string(kLongETLDDomain));
+ builder.AddRegisterableDomain(std::string(kIPAddress));
+ builder.AddRegisterableDomain(std::string(kUnknownRegistryDomain));
+ builder.AddRegisterableDomain(std::string(kInternalHostname));
+ base::Callback<bool(const std::string&)> filter =
+ builder.BuildPluginFilter();
+
+ TestCase test_cases[] = {
+ // Plugin sites can be domains, ...
+ {"google.com", false},
+ {"www.google.com", false},
+ {"website.sp.nom.br", false},
+ {"www.website.sp.nom.br", false},
+ {"second-level-domain.fileserver", false},
+ {"foo.bar.second-level-domain.fileserver", false},
+
+ // ... IP addresses, or internal hostnames.
+ {"192.168.1.1", false},
+ {"fileserver", false},
+
+ // Sites not in the blacklist are matched.
+ {"example.com", true},
+ {"192.168.1.2", true},
+ {"website.fileserver", true},
+ };
+
+ for (TestCase test_case : test_cases)
+ RunTestCase(test_case, filter);
+}
« no previous file with comments | « chrome/browser/browsing_data/registrable_domain_filter_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698