Index: chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
index 842d930827d7d16249328fc1a8db87bb2041b387..a5b8406a18c83a4bfbcb7d71f7996c7ee4946c0b 100644 |
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc |
@@ -396,6 +396,10 @@ bool ProbablySameFilters( |
return ProbablySameFilter(filter1).MatchAndExplain(filter2, nullptr); |
} |
+base::Time HourAgo() { |
Bernhard Bauer
2016/12/16 17:03:05
Small nit: AnHourAgo()?
msramek
2017/01/03 12:06:53
Done.
|
+ return base::Time::Now() - base::TimeDelta::FromHours(1); |
+} |
+ |
} // namespace |
// Testers ------------------------------------------------------------------- |
@@ -1154,7 +1158,8 @@ class BrowsingDataRemoverTest : public testing::Test { |
TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); |
} |
- void BlockUntilBrowsingDataRemoved(browsing_data::TimePeriod period, |
+ void BlockUntilBrowsingDataRemoved(const base::Time& delete_begin, |
+ const base::Time& delete_end, |
int remove_mask, |
bool include_protected_origins) { |
BrowsingDataRemover* remover = |
@@ -1168,8 +1173,9 @@ class BrowsingDataRemoverTest : public testing::Test { |
origin_type_mask |= BrowsingDataHelper::PROTECTED_WEB; |
BrowsingDataRemoverCompletionObserver completion_observer(remover); |
- remover->RemoveAndReply(BrowsingDataRemover::Period(period), remove_mask, |
- origin_type_mask, &completion_observer); |
+ remover->RemoveAndReply( |
+ delete_begin, delete_end, remove_mask, origin_type_mask, |
+ &completion_observer); |
completion_observer.BlockUntilCompletion(); |
// Save so we can verify later. |
@@ -1178,7 +1184,8 @@ class BrowsingDataRemoverTest : public testing::Test { |
} |
void BlockUntilOriginDataRemoved( |
- browsing_data::TimePeriod period, |
+ const base::Time& delete_begin, |
+ const base::Time& delete_end, |
int remove_mask, |
const BrowsingDataFilterBuilder& filter_builder) { |
BrowsingDataRemover* remover = |
@@ -1187,8 +1194,8 @@ class BrowsingDataRemoverTest : public testing::Test { |
remover->OverrideStoragePartitionForTesting(&storage_partition); |
BrowsingDataRemoverCompletionInhibitor completion_inhibitor; |
- remover->RemoveImpl(BrowsingDataRemover::Period(period), remove_mask, |
- filter_builder, BrowsingDataHelper::UNPROTECTED_WEB); |
+ remover->RemoveImpl(delete_begin, delete_end, remove_mask, filter_builder, |
+ BrowsingDataHelper::UNPROTECTED_WEB); |
completion_inhibitor.BlockUntilNearCompletion(); |
completion_inhibitor.ContinueToCompletion(); |
@@ -1273,7 +1280,7 @@ class BrowsingDataRemoverTest : public testing::Test { |
// Tests --------------------------------------------------------------------- |
TEST_F(BrowsingDataRemoverTest, RemoveCookieForever) { |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
@@ -1289,7 +1296,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieForever) { |
} |
TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
@@ -1299,7 +1306,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { |
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
EXPECT_EQ(removal_data.remove_mask, |
StoragePartition::REMOVE_DATA_MASK_COOKIES); |
- // Removing with time period other than ALL_TIME should not clear |
+ // Removing with time period other than all time should not clear |
// persistent storage data. |
EXPECT_EQ(removal_data.quota_storage_remove_mask, |
~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
@@ -1311,7 +1318,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookiesDomainBlacklist) { |
RegistrableDomainFilterBuilder::BLACKLIST); |
filter.AddRegisterableDomain(kTestRegisterableDomain1); |
filter.AddRegisterableDomain(kTestRegisterableDomain3); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, filter); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
@@ -1321,7 +1328,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookiesDomainBlacklist) { |
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
EXPECT_EQ(removal_data.remove_mask, |
StoragePartition::REMOVE_DATA_MASK_COOKIES); |
- // Removing with time period other than ALL_TIME should not clear |
+ // Removing with time period other than all time should not clear |
// persistent storage data. |
EXPECT_EQ(removal_data.quota_storage_remove_mask, |
~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
@@ -1346,7 +1353,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { |
tester.AddCookie(); |
ASSERT_TRUE(tester.ContainsCookie()); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
@@ -1360,12 +1367,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieLastHour) { |
tester.AddCookie(); |
ASSERT_TRUE(tester.ContainsCookie()); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
- // Removing with time period other than ALL_TIME should not clear safe |
+ // Removing with time period other than all time should not clear safe |
// browsing cookies. |
EXPECT_TRUE(tester.ContainsCookie()); |
} |
@@ -1378,7 +1385,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForeverWithPredicate) { |
RegistrableDomainFilterBuilder filter( |
RegistrableDomainFilterBuilder::BLACKLIST); |
filter.AddRegisterableDomain(kTestRegisterableDomain1); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, filter); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); |
@@ -1388,7 +1395,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForeverWithPredicate) { |
RegistrableDomainFilterBuilder filter2( |
RegistrableDomainFilterBuilder::WHITELIST); |
filter2.AddRegisterableDomain(kTestRegisterableDomain1); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, filter2); |
EXPECT_FALSE(tester.ContainsCookie()); |
} |
@@ -1400,7 +1407,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveChannelIDForever) { |
EXPECT_EQ(0, tester.ssl_config_changed_count()); |
EXPECT_EQ(1, tester.ChannelIDCount()); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_CHANNEL_IDS, GetRemovalMask()); |
@@ -1419,7 +1426,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveChannelIDLastHour) { |
EXPECT_EQ(0, tester.ssl_config_changed_count()); |
EXPECT_EQ(2, tester.ChannelIDCount()); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_CHANNEL_IDS, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_CHANNEL_IDS, GetRemovalMask()); |
@@ -1443,7 +1450,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveChannelIDsForServerIdentifiers) { |
RegistrableDomainFilterBuilder::WHITELIST); |
filter_builder.AddRegisterableDomain(kTestRegisterableDomain1); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_CHANNEL_IDS, |
filter_builder); |
@@ -1460,7 +1467,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveUnprotectedLocalStorageForever) { |
policy->AddProtected(kOrigin1.GetOrigin()); |
#endif |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_LOCAL_STORAGE, |
false); |
@@ -1490,7 +1497,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveProtectedLocalStorageForever) { |
policy->AddProtected(kOrigin1.GetOrigin()); |
#endif |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_LOCAL_STORAGE, |
true); |
@@ -1519,9 +1526,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) { |
CreateMockPolicy(); |
#endif |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_WEEK, |
- BrowsingDataRemover::REMOVE_LOCAL_STORAGE, |
- false); |
+ BlockUntilBrowsingDataRemoved( |
+ base::Time::Now() - base::TimeDelta::FromDays(7), base::Time::Max(), |
+ BrowsingDataRemover::REMOVE_LOCAL_STORAGE, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); |
EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
@@ -1549,7 +1556,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) { |
tester.AddHistory(kOrigin1, base::Time::Now()); |
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
@@ -1568,7 +1575,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveHistoryForLastHour) { |
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); |
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin2)); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
@@ -1593,7 +1600,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveHistoryProhibited) { |
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1)); |
ASSERT_TRUE(tester.HistoryContainsURL(kOrigin2)); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
@@ -1614,7 +1621,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypes) { |
int removal_mask = BrowsingDataRemover::REMOVE_HISTORY | |
BrowsingDataRemover::REMOVE_COOKIES; |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, removal_mask, false); |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
+ removal_mask, false); |
EXPECT_EQ(removal_mask, GetRemovalMask()); |
EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
@@ -1645,7 +1653,8 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) { |
int removal_mask = BrowsingDataRemover::REMOVE_HISTORY | |
BrowsingDataRemover::REMOVE_COOKIES; |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, removal_mask, false); |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
+ removal_mask, false); |
EXPECT_EQ(removal_mask, GetRemovalMask()); |
EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginTypeMask()); |
@@ -1657,7 +1666,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) { |
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); |
EXPECT_EQ(removal_data.remove_mask, |
StoragePartition::REMOVE_DATA_MASK_COOKIES); |
- // Persistent storage won't be deleted, since ALL_TIME was not specified. |
+ // Persistent storage won't be deleted, since the time period is not all time. |
EXPECT_EQ(removal_data.quota_storage_remove_mask, |
~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); |
} |
@@ -1672,7 +1681,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveFaviconsForever) { |
favicon_tester.VisitAndAddFavicon(page_url); |
ASSERT_TRUE(favicon_tester.HasFaviconForPageURL(page_url)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
EXPECT_FALSE(favicon_tester.HasFaviconForPageURL(page_url)); |
@@ -1699,7 +1708,7 @@ TEST_F(BrowsingDataRemoverTest, ExpireBookmarkFavicons) { |
favicon_tester.VisitAndAddFavicon(bookmarked_page); |
ASSERT_TRUE(favicon_tester.HasFaviconForPageURL(bookmarked_page)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
EXPECT_TRUE(favicon_tester.HasExpiredFaviconForPageURL(bookmarked_page)); |
@@ -1707,7 +1716,7 @@ TEST_F(BrowsingDataRemoverTest, ExpireBookmarkFavicons) { |
TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverBoth) { |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1744,7 +1753,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) { |
#endif |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1788,7 +1797,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) { |
#endif |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1832,7 +1841,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) { |
#endif |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1875,7 +1884,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { |
RegistrableDomainFilterBuilder::WHITELIST); |
builder.AddRegisterableDomain(kTestRegisterableDomain1); |
// Remove Origin 1. |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_APPCACHE | |
BrowsingDataRemover::REMOVE_SERVICE_WORKERS | |
BrowsingDataRemover::REMOVE_CACHE_STORAGE | |
@@ -1913,7 +1922,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { |
TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { |
BlockUntilBrowsingDataRemoved( |
- browsing_data::LAST_HOUR, |
+ HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1953,7 +1962,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { |
TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) { |
BlockUntilBrowsingDataRemoved( |
- browsing_data::LAST_WEEK, |
+ base::Time::Now() - base::TimeDelta::FromDays(7), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -1999,7 +2008,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedUnprotectedOrigins) { |
#endif |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FILE_SYSTEMS | |
BrowsingDataRemover::REMOVE_WEBSQL | |
BrowsingDataRemover::REMOVE_APPCACHE | |
@@ -2049,7 +2058,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) { |
builder.AddRegisterableDomain(kTestRegisterableDomain1); |
// Try to remove kOrigin1. Expect failure. |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_APPCACHE | |
BrowsingDataRemover::REMOVE_SERVICE_WORKERS | |
BrowsingDataRemover::REMOVE_CACHE_STORAGE | |
@@ -2098,7 +2107,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) { |
// Try to remove kOrigin1. Expect success. |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_APPCACHE | |
BrowsingDataRemover::REMOVE_SERVICE_WORKERS | |
BrowsingDataRemover::REMOVE_CACHE_STORAGE | |
@@ -2143,7 +2152,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) { |
#endif |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_APPCACHE | |
BrowsingDataRemover::REMOVE_SERVICE_WORKERS | |
BrowsingDataRemover::REMOVE_CACHE_STORAGE | |
@@ -2193,7 +2202,7 @@ TEST_F(BrowsingDataRemoverTest, TimeBasedHistoryRemoval) { |
RegistrableDomainFilterBuilder builder( |
RegistrableDomainFilterBuilder::BLACKLIST); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, builder); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
@@ -2211,7 +2220,7 @@ TEST_F(BrowsingDataRemoverTest, AutofillRemovalLastHour) { |
tester.AddProfilesAndCards(); |
ASSERT_TRUE(tester.HasProfile()); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FORM_DATA, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_FORM_DATA, GetRemovalMask()); |
@@ -2227,7 +2236,7 @@ TEST_F(BrowsingDataRemoverTest, AutofillRemovalEverything) { |
tester.AddProfilesAndCards(); |
ASSERT_TRUE(tester.HasProfile()); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_FORM_DATA, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_FORM_DATA, GetRemovalMask()); |
@@ -2245,7 +2254,7 @@ TEST_F(BrowsingDataRemoverTest, AutofillOriginsRemovedWithHistory) { |
EXPECT_TRUE(tester.HasOrigin(kWebOrigin)); |
EXPECT_TRUE(tester.HasOrigin(autofill::kSettingsOrigin)); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
@@ -2282,7 +2291,7 @@ TEST_F(BrowsingDataRemoverTest, CompletionInhibition) { |
BrowsingDataRemover* remover = |
BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile()); |
InspectableCompletionObserver completion_observer(remover); |
- remover->RemoveAndReply(BrowsingDataRemover::Unbounded(), |
+ remover->RemoveAndReply(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, |
BrowsingDataHelper::UNPROTECTED_WEB, |
&completion_observer); |
@@ -2312,7 +2321,7 @@ TEST_F(BrowsingDataRemoverTest, EarlyShutdown) { |
BrowsingDataRemoverFactory::GetForBrowserContext(GetProfile()); |
InspectableCompletionObserver completion_observer(remover); |
BrowsingDataRemoverCompletionInhibitor completion_inhibitor; |
- remover->RemoveAndReply(BrowsingDataRemover::Unbounded(), |
+ remover->RemoveAndReply(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, |
BrowsingDataHelper::UNPROTECTED_WEB, |
&completion_observer); |
@@ -2338,7 +2347,7 @@ TEST_F(BrowsingDataRemoverTest, ZeroSuggestCacheClear) { |
PrefService* prefs = GetProfile()->GetPrefs(); |
prefs->SetString(omnibox::kZeroSuggestCachedResults, |
"[\"\", [\"foo\", \"bar\"]]"); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
// Expect the prefs to be cleared when cookies are removed. |
@@ -2369,7 +2378,7 @@ TEST_F(BrowsingDataRemoverTest, ContentProtectionPlatformKeysRemoval) { |
EXPECT_CALL(*cryptohome_client, TpmAttestationDeleteKeys(_, _, _, _)) |
.WillOnce(WithArgs<3>(Invoke(FakeDBusCall))); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_MEDIA_LICENSES, |
false); |
@@ -2388,7 +2397,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_Beacons) { |
const ClearDomainReliabilityTester& tester = |
clear_domain_reliability_tester(); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
EXPECT_EQ(1u, tester.clear_count()); |
EXPECT_EQ(CLEAR_BEACONS, tester.last_clear_mode()); |
@@ -2404,7 +2413,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_Beacons_WithFilter) { |
RegistrableDomainFilterBuilder::WHITELIST); |
builder.AddRegisterableDomain(kTestRegisterableDomain1); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, builder); |
EXPECT_EQ(1u, tester.clear_count()); |
EXPECT_EQ(CLEAR_BEACONS, tester.last_clear_mode()); |
@@ -2416,7 +2425,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_Contexts) { |
const ClearDomainReliabilityTester& tester = |
clear_domain_reliability_tester(); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(1u, tester.clear_count()); |
EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
@@ -2432,7 +2441,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_Contexts_WithFilter) { |
RegistrableDomainFilterBuilder::WHITELIST); |
builder.AddRegisterableDomain(kTestRegisterableDomain1); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, builder); |
EXPECT_EQ(1u, tester.clear_count()); |
EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
@@ -2445,7 +2454,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_ContextsWin) { |
clear_domain_reliability_tester(); |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY | BrowsingDataRemover::REMOVE_COOKIES, |
false); |
EXPECT_EQ(1u, tester.clear_count()); |
@@ -2456,7 +2465,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_ProtectedOrigins) { |
const ClearDomainReliabilityTester& tester = |
clear_domain_reliability_tester(); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, true); |
EXPECT_EQ(1u, tester.clear_count()); |
EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
@@ -2468,7 +2477,7 @@ TEST_F(BrowsingDataRemoverTest, DomainReliability_ProtectedOrigins) { |
// monitor case again. |
TEST_F(BrowsingDataRemoverTest, DISABLED_DomainReliability_NoMonitor) { |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY | BrowsingDataRemover::REMOVE_COOKIES, |
false); |
} |
@@ -2482,7 +2491,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByTimeOnly) { |
*tester.download_manager(), |
RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_DOWNLOADS, false); |
} |
@@ -2497,7 +2506,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByOrigin) { |
*tester.download_manager(), |
RemoveDownloadsByURLAndTime(ProbablySameFilter(filter), _, _)); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_DOWNLOADS, builder); |
} |
@@ -2508,7 +2517,7 @@ TEST_F(BrowsingDataRemoverTest, RemovePasswordStatistics) { |
EXPECT_CALL(*tester.store(), RemoveStatisticsByOriginAndTimeImpl( |
ProbablySameFilter(empty_filter), |
base::Time(), base::Time::Max())); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
} |
@@ -2523,7 +2532,7 @@ TEST_F(BrowsingDataRemoverTest, RemovePasswordStatisticsByOrigin) { |
EXPECT_CALL(*tester.store(), |
RemoveStatisticsByOriginAndTimeImpl( |
ProbablySameFilter(filter), base::Time(), base::Time::Max())); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, builder); |
} |
@@ -2535,7 +2544,7 @@ TEST_F(BrowsingDataRemoverTest, RemovePasswordsByTimeOnly) { |
EXPECT_CALL(*tester.store(), |
RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) |
.WillOnce(Return(password_manager::PasswordStoreChangeList())); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_PASSWORDS, false); |
} |
@@ -2549,7 +2558,7 @@ TEST_F(BrowsingDataRemoverTest, RemovePasswordsByOrigin) { |
EXPECT_CALL(*tester.store(), |
RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) |
.WillOnce(Return(password_manager::PasswordStoreChangeList())); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_PASSWORDS, builder); |
} |
@@ -2563,7 +2572,7 @@ TEST_F(BrowsingDataRemoverTest, DisableAutoSignIn) { |
DisableAutoSignInForOriginsImpl(ProbablySameFilter(empty_filter))) |
.WillOnce(Return(password_manager::PasswordStoreChangeList())); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
} |
@@ -2579,7 +2588,7 @@ TEST_F(BrowsingDataRemoverTest, DisableAutoSignInAfterRemovingPasswords) { |
DisableAutoSignInForOriginsImpl(ProbablySameFilter(empty_filter))) |
.WillOnce(Return(password_manager::PasswordStoreChangeList())); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES | |
BrowsingDataRemover::REMOVE_PASSWORDS, |
false); |
@@ -2607,7 +2616,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveContentSettingsWithBlacklist) { |
RegistrableDomainFilterBuilder::BLACKLIST); |
filter.AddRegisterableDomain(kTestRegisterableDomain1); |
filter.AddRegisterableDomain(kTestRegisterableDomain3); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, |
filter); |
@@ -2646,7 +2655,7 @@ TEST_F(BrowsingDataRemoverTest, RemoveDurablePermission) { |
RegistrableDomainFilterBuilder::BLACKLIST); |
filter.AddRegisterableDomain(kTestRegisterableDomain1); |
filter.AddRegisterableDomain(kTestRegisterableDomain3); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_DURABLE_PERMISSION, |
filter); |
@@ -2690,7 +2699,7 @@ TEST_F(BrowsingDataRemoverTest, ClearHttpAuthCache_RemoveCookies) { |
CHECK(http_auth_cache->Lookup(kOrigin1, kTestRealm, |
net::HttpAuth::AUTH_SCHEME_BASIC)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, false); |
EXPECT_EQ(nullptr, http_auth_cache->Lookup(kOrigin1, kTestRealm, |
@@ -2715,7 +2724,7 @@ TEST_F(BrowsingDataRemoverTest, ClearHttpAuthCache_RemovePasswords) { |
CHECK(http_auth_cache->Lookup(kOrigin1, kTestRealm, |
net::HttpAuth::AUTH_SCHEME_BASIC)); |
- BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilBrowsingDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_PASSWORDS, false); |
EXPECT_EQ(nullptr, http_auth_cache->Lookup(kOrigin1, kTestRealm, |
@@ -2748,7 +2757,7 @@ TEST_F(BrowsingDataRemoverTest, ClearPermissionPromptCounts) { |
tester.ShouldChangeDismissalToBlock(kOrigin2, |
content::PermissionType::NOTIFICATIONS); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, |
filter_builder_1); |
@@ -2764,7 +2773,7 @@ TEST_F(BrowsingDataRemoverTest, ClearPermissionPromptCounts) { |
EXPECT_EQ(1, tester.GetDismissCount( |
kOrigin2, content::PermissionType::NOTIFICATIONS)); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, false); |
// Everything should be gone. |
@@ -2794,7 +2803,7 @@ TEST_F(BrowsingDataRemoverTest, ClearPermissionPromptCounts) { |
tester.ShouldChangeDismissalToBlock(kOrigin2, |
content::PermissionType::NOTIFICATIONS); |
- BlockUntilOriginDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilOriginDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, |
filter_builder_2); |
@@ -2810,7 +2819,7 @@ TEST_F(BrowsingDataRemoverTest, ClearPermissionPromptCounts) { |
EXPECT_EQ(0, tester.GetDismissCount( |
kOrigin2, content::PermissionType::NOTIFICATIONS)); |
- BlockUntilBrowsingDataRemoved(browsing_data::LAST_HOUR, |
+ BlockUntilBrowsingDataRemoved(HourAgo(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_SITE_USAGE_DATA, |
false); |
@@ -2844,7 +2853,7 @@ TEST_F(BrowsingDataRemoverTest, RemovePluginData) { |
RegistrableDomainFilterBuilder filter_builder( |
RegistrableDomainFilterBuilder::WHITELIST); |
filter_builder.AddRegisterableDomain(kTestRegisterableDomain3); |
- BlockUntilOriginDataRemoved(browsing_data::ALL_TIME, |
+ BlockUntilOriginDataRemoved(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_PLUGIN_DATA, |
filter_builder); |
@@ -2929,33 +2938,32 @@ TEST_F(BrowsingDataRemoverTest, MultipleTasks) { |
// Test several tasks with various configuration of masks, filters, and target |
// observers. |
std::list<BrowsingDataRemover::RemovalTask> tasks; |
- tasks.emplace_back(BrowsingDataRemover::Unbounded(), |
+ tasks.emplace_back(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, |
BrowsingDataHelper::UNPROTECTED_WEB, |
base::MakeUnique<RegistrableDomainFilterBuilder>( |
RegistrableDomainFilterBuilder::BLACKLIST), |
observer.target_a()); |
- tasks.emplace_back(BrowsingDataRemover::Unbounded(), |
+ tasks.emplace_back(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, |
BrowsingDataHelper::PROTECTED_WEB, |
base::MakeUnique<RegistrableDomainFilterBuilder>( |
RegistrableDomainFilterBuilder::BLACKLIST), |
nullptr); |
tasks.emplace_back( |
- BrowsingDataRemover::TimeRange(base::Time::Now(), base::Time::Max()), |
+ base::Time::Now(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_PASSWORDS, BrowsingDataHelper::ALL, |
base::MakeUnique<RegistrableDomainFilterBuilder>( |
RegistrableDomainFilterBuilder::BLACKLIST), |
observer.target_b()); |
tasks.emplace_back( |
- BrowsingDataRemover::TimeRange(base::Time(), base::Time::UnixEpoch()), |
+ base::Time(), base::Time::UnixEpoch(), |
BrowsingDataRemover::REMOVE_WEBSQL, |
BrowsingDataHelper::UNPROTECTED_WEB, |
std::move(filter_builder_1), |
observer.target_b()); |
tasks.emplace_back( |
- BrowsingDataRemover::TimeRange( |
- base::Time::UnixEpoch(), base::Time::Now()), |
+ base::Time::UnixEpoch(), base::Time::Now(), |
BrowsingDataRemover::REMOVE_CHANNEL_IDS, |
BrowsingDataHelper::ALL, |
std::move(filter_builder_2), |
@@ -2967,17 +2975,19 @@ TEST_F(BrowsingDataRemoverTest, MultipleTasks) { |
// Remove.* instead. This also serves as a test that those methods are all |
// correctly reduced to RemoveInternal(). |
if (!task.observer && task.filter_builder->IsEmptyBlacklist()) { |
- remover->Remove(task.time_range, task.remove_mask, task.origin_type_mask); |
+ remover->Remove(task.delete_begin, task.delete_end, |
+ task.remove_mask, task.origin_type_mask); |
} else if (task.filter_builder->IsEmptyBlacklist()) { |
- remover->RemoveAndReply(task.time_range, task.remove_mask, |
- task.origin_type_mask, task.observer); |
+ remover->RemoveAndReply(task.delete_begin, task.delete_end, |
+ task.remove_mask, task.origin_type_mask, |
+ task.observer); |
} else if (!task.observer) { |
- remover->RemoveWithFilter(task.time_range, task.remove_mask, |
- task.origin_type_mask, |
+ remover->RemoveWithFilter(task.delete_begin, task.delete_end, |
+ task.remove_mask, task.origin_type_mask, |
std::move(task.filter_builder)); |
} else { |
- remover->RemoveWithFilterAndReply(task.time_range, task.remove_mask, |
- task.origin_type_mask, |
+ remover->RemoveWithFilterAndReply(task.delete_begin, task.delete_end, |
+ task.remove_mask, task.origin_type_mask, |
std::move(task.filter_builder), |
task.observer); |
} |
@@ -3000,7 +3010,7 @@ TEST_F(BrowsingDataRemoverTest, MultipleTasks) { |
// filter builder and exposed it, we could also test it here. Make it so. |
EXPECT_EQ(task.remove_mask, GetRemovalMask()); |
EXPECT_EQ(task.origin_type_mask, GetOriginTypeMask()); |
- EXPECT_EQ(task.time_range.begin, GetBeginTime()); |
+ EXPECT_EQ(task.delete_begin, GetBeginTime()); |
} |
EXPECT_FALSE(remover->is_removing()); |
@@ -3035,7 +3045,7 @@ TEST_F(BrowsingDataRemoverTest, MultipleTasksInQuickSuccession) { |
}; |
for (int removal_mask : test_removal_masks) { |
- remover->Remove(BrowsingDataRemover::Unbounded(), removal_mask, |
+ remover->Remove(base::Time(), base::Time::Max(), removal_mask, |
BrowsingDataHelper::UNPROTECTED_WEB); |
} |
@@ -3043,7 +3053,7 @@ TEST_F(BrowsingDataRemoverTest, MultipleTasksInQuickSuccession) { |
// Add one more deletion and wait for it. |
BlockUntilBrowsingDataRemoved( |
- browsing_data::ALL_TIME, |
+ base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_COOKIES, |
BrowsingDataHelper::UNPROTECTED_WEB); |
@@ -3087,7 +3097,7 @@ TEST_F(BrowsingDataRemoverTest, BookmarkLastVisitDatesGetCleared) { |
BrowsingDataRemoverFactory::GetForBrowserContext(&profile); |
BrowsingDataRemoverCompletionObserver completion_observer(remover); |
- remover->RemoveAndReply(BrowsingDataRemover::Unbounded(), |
+ remover->RemoveAndReply(base::Time(), base::Time::Max(), |
BrowsingDataRemover::REMOVE_HISTORY, |
BrowsingDataHelper::ALL, &completion_observer); |
completion_observer.BlockUntilCompletion(); |