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

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

Issue 1651913003: Handle origin-specific password deletion in BrowsingDataRemover (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments; switch to checking GURL emptiness for origin-based deletion. Created 4 years, 10 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/browsing_data_remover.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/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 9a824c451912b984f3ebd83924185826d54a678d..48b718acaeed3ffd90abd31d02ce09ba685ff592 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -878,6 +878,29 @@ class RemoveDownloadsTester {
DISALLOW_COPY_AND_ASSIGN(RemoveDownloadsTester);
};
+class RemovePasswordsTester {
+ public:
+ explicit RemovePasswordsTester(TestingProfile* testing_profile) {
+ PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
+ testing_profile,
+ password_manager::BuildPasswordStore<
+ content::BrowserContext,
+ testing::NiceMock<password_manager::MockPasswordStore>>);
+
+ store_ = static_cast<password_manager::MockPasswordStore*>(
+ PasswordStoreFactory::GetInstance()
+ ->GetForProfile(testing_profile, ServiceAccessType::EXPLICIT_ACCESS)
+ .get());
+ }
+
+ password_manager::MockPasswordStore* store() { return store_; }
+
+ private:
+ password_manager::MockPasswordStore* store_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemovePasswordsTester);
+};
+
// Test Class ----------------------------------------------------------------
class BrowsingDataRemoverTest : public testing::Test {
@@ -2145,7 +2168,16 @@ TEST_F(BrowsingDataRemoverTest, DISABLED_DomainReliability_NoMonitor) {
BrowsingDataRemover::REMOVE_COOKIES, false);
}
-TEST_F(BrowsingDataRemoverTest, RemoveSameOriginDownloads) {
+TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByTimeOnly) {
+ RemoveDownloadsTester tester(GetProfile());
+
+ EXPECT_CALL(*tester.download_manager(), RemoveDownloadsBetween(_, _));
+
+ BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
+ BrowsingDataRemover::REMOVE_DOWNLOADS, false);
+}
+
+TEST_F(BrowsingDataRemoverTest, RemoveDownloadsByOrigin) {
RemoveDownloadsTester tester(GetProfile());
const url::Origin expectedOrigin(kOrigin1);
@@ -2157,18 +2189,31 @@ TEST_F(BrowsingDataRemoverTest, RemoveSameOriginDownloads) {
}
TEST_F(BrowsingDataRemoverTest, RemovePasswordStatistics) {
- PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
- GetProfile(),
- password_manager::BuildPasswordStore<
- content::BrowserContext, password_manager::MockPasswordStore>);
- password_manager::MockPasswordStore* store =
- static_cast<password_manager::MockPasswordStore*>(
- PasswordStoreFactory::GetInstance()
- ->GetForProfile(GetProfile(), ServiceAccessType::EXPLICIT_ACCESS)
- .get());
- EXPECT_CALL(*store, RemoveStatisticsCreatedBetweenImpl(base::Time(),
- base::Time::Max()));
+ RemovePasswordsTester tester(GetProfile());
+
+ EXPECT_CALL(*tester.store(), RemoveStatisticsCreatedBetweenImpl(
+ base::Time(), base::Time::Max()));
BlockUntilBrowsingDataRemoved(
BrowsingDataRemover::EVERYTHING,
BrowsingDataRemover::REMOVE_HISTORY, false);
}
+
+TEST_F(BrowsingDataRemoverTest, RemovePasswordsByTimeOnly) {
+ RemovePasswordsTester tester(GetProfile());
+
+ EXPECT_CALL(*tester.store(), RemoveLoginsCreatedBetweenImpl(_, _))
+ .WillOnce(Return(password_manager::PasswordStoreChangeList()));
+ BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
+ BrowsingDataRemover::REMOVE_PASSWORDS, false);
+}
+
+TEST_F(BrowsingDataRemoverTest, RemovePasswordsByOrigin) {
+ RemovePasswordsTester tester(GetProfile());
+ const url::Origin expectedOrigin(kOrigin1);
+
+ EXPECT_CALL(*tester.store(),
+ RemoveLoginsByOriginAndTimeImpl(SameOrigin(expectedOrigin), _, _))
+ .WillOnce(Return(password_manager::PasswordStoreChangeList()));
+ BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING,
+ BrowsingDataRemover::REMOVE_PASSWORDS, kOrigin1);
+}
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698