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

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

Issue 2320763002: Support origin-based deletion for password store statistics (Closed)
Patch Set: Mac-specific code Created 4 years, 3 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/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 5ec7e1c73275920e9ef09468659c40ecc0e62924..821a6c937fce88308ffa98c3df878a84d7642aff 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -361,6 +361,11 @@ class ProbablySameFilterMatcher
virtual bool MatchAndExplain(const base::Callback<bool(const GURL&)>& filter,
MatchResultListener* listener) const {
+ if (filter.is_null() && to_match_.is_null())
+ return true;
+ if (filter.is_null() != to_match_.is_null())
+ return false;
+
const GURL urls_to_test_[] =
{kOrigin1, kOrigin2, kOrigin3, GURL("invalid spec")};
for (GURL url : urls_to_test_) {
@@ -2502,13 +2507,30 @@ TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByOrigin) {
TEST_F(BrowsingDataRemoverTest, RemovePasswordStatistics) {
RemovePasswordsTester tester(GetProfile());
+ base::Callback<bool(const GURL&)> empty_filter;
- EXPECT_CALL(*tester.store(), RemoveStatisticsCreatedBetweenImpl(
+ EXPECT_CALL(*tester.store(), RemoveStatisticsByOriginAndTimeImpl(
+ ProbablySameFilter(empty_filter),
base::Time(), base::Time::Max()));
BlockUntilBrowsingDataRemoved(browsing_data::ALL_TIME,
BrowsingDataRemover::REMOVE_HISTORY, false);
}
+TEST_F(BrowsingDataRemoverTest, RemovePasswordStatisticsByOrigin) {
+ RemovePasswordsTester tester(GetProfile());
+
+ RegistrableDomainFilterBuilder builder(
+ RegistrableDomainFilterBuilder::WHITELIST);
+ builder.AddRegisterableDomain(kTestRegisterableDomain1);
+ base::Callback<bool(const GURL&)> filter = builder.BuildGeneralFilter();
+
+ EXPECT_CALL(*tester.store(),
+ RemoveStatisticsByOriginAndTimeImpl(
+ ProbablySameFilter(filter), base::Time(), base::Time::Max()));
+ BlockUntilOriginDataRemoved(browsing_data::ALL_TIME,
+ BrowsingDataRemover::REMOVE_HISTORY, builder);
+}
+
TEST_F(BrowsingDataRemoverTest, RemovePasswordsByTimeOnly) {
RemovePasswordsTester tester(GetProfile());
base::Callback<bool(const GURL&)> filter =
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | chrome/browser/password_manager/password_store_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698