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

Unified Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 2398253003: Early exit from autofill profile de-duplication if <2 profiles. (Closed)
Patch Set: Created 4 years, 2 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 | « components/autofill/core/browser/personal_data_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/personal_data_manager_unittest.cc
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc
index 06776f10ef6d2fffee7825646e04991345558f99..b9a9cfc32d729afd5eba5fcbe37b1f174bbdf534 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -5284,6 +5284,33 @@ TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_FeatureDisabled) {
EXPECT_EQ(2U, personal_data_->GetProfiles().size());
}
+TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_NopIfZeroProfiles) {
+ EXPECT_TRUE(personal_data_->GetProfiles().empty());
+ EnableAutofillProfileCleanup();
+ EXPECT_FALSE(personal_data_->ApplyDedupingRoutine());
+}
+
+TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_NopIfOneProfile) {
+ // Create a profile to dedupe.
+ AutofillProfile profile(base::GenerateGUID(), "https://www.example.com");
+ test::SetProfileInfo(&profile, "Homer", "J", "Simpson",
+ "homer.simpson@abc.com", "", "742. Evergreen Terrace",
+ "", "Springfield", "IL", "91601", "US", "");
+
+ personal_data_->AddProfile(profile);
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
+ .WillOnce(QuitMainMessageLoop());
+ base::RunLoop().Run();
+
+ EXPECT_EQ(1U, personal_data_->GetProfiles().size());
+
+ // Enable the profile cleanup now. Otherwise it would be triggered by the
+ // calls to AddProfile.
+ EnableAutofillProfileCleanup();
+ EXPECT_FALSE(personal_data_->ApplyDedupingRoutine());
+}
+
+
// Tests that ApplyDedupingRoutine is not run a second time on the same major
// version.
TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_OncePerVersion) {
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698