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

Unified Diff: chrome/browser/search_engines/template_url_service_unittest.cc

Issue 2289853002: Extend the origin-based deletion in TemplateURLService to an URL filter (Closed)
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
Index: chrome/browser/search_engines/template_url_service_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
index cb1655448478db489fba4b89fffffa88aefb4fa1..482d6dd6426ba8a006a2e044072f2ec6b17dff0e 100644
--- a/chrome/browser/search_engines/template_url_service_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_unittest.cc
@@ -571,7 +571,7 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_Keywords) {
EXPECT_EQ(2U, model()->GetTemplateURLs().size());
}
-TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForOrigin) {
+TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForUrls) {
Time now = Time::Now();
TimeDelta one_day = TimeDelta::FromDays(1);
Time month_ago = now - TimeDelta::FromDays(30);
@@ -594,7 +594,9 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForOrigin) {
EXPECT_EQ(3U, model()->GetTemplateURLs().size());
// Try removing foo2. This should delete foo2, but leave foo1 and 3 untouched.
- model()->RemoveAutoGeneratedForOriginBetween(GURL("http://foo2"), month_ago,
+ GURL url2("http://foo2");
+ model()->RemoveAutoGeneratedForUrlsBetween(
+ base::Bind(&GURL::operator==, base::Unretained(&url2)), month_ago,
now + one_day);
EXPECT_EQ(2U, model()->GetTemplateURLs().size());
EXPECT_EQ(ASCIIToUTF16("key1"), model()->GetTemplateURLs()[0]->keyword());
@@ -604,7 +606,9 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForOrigin) {
// Try removing foo1, but outside the range in which it was modified. It
// should remain untouched.
- model()->RemoveAutoGeneratedForOriginBetween(GURL("http://foo1"), now,
+ GURL url1("http://foo1");
+ model()->RemoveAutoGeneratedForUrlsBetween(
+ base::Bind(&GURL::operator==, base::Unretained(&url1)), now,
now + one_day);
EXPECT_EQ(2U, model()->GetTemplateURLs().size());
EXPECT_EQ(ASCIIToUTF16("key1"), model()->GetTemplateURLs()[0]->keyword());
@@ -612,9 +616,10 @@ TEST_F(TemplateURLServiceTest, ClearBrowsingData_KeywordsForOrigin) {
EXPECT_EQ(ASCIIToUTF16("key3"), model()->GetTemplateURLs()[1]->keyword());
EXPECT_TRUE(model()->GetTemplateURLs()[1]->safe_for_autoreplace());
-
// Try removing foo3. This should delete foo3, but leave foo1 untouched.
- model()->RemoveAutoGeneratedForOriginBetween(GURL("http://foo3"), month_ago,
+ GURL url3("http://foo3");
+ model()->RemoveAutoGeneratedForUrlsBetween(
+ base::Bind(&GURL::operator==, base::Unretained(&url3)), month_ago,
now + one_day + one_day);
EXPECT_EQ(1U, model()->GetTemplateURLs().size());
EXPECT_EQ(ASCIIToUTF16("key1"), model()->GetTemplateURLs()[0]->keyword());
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | components/search_engines/template_url_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698