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

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

Issue 578383002: mac: Only show the access Address Book prompt a fixed number of times. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill-contacts
Patch Set: Comments from isherman, round 2. Created 6 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: 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 0b537bbefe2cd597b7ff066be1963cb8f1856788..21d93ce1704e510d024e1a0cc8c30e9e80dff4e1 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -2701,6 +2701,24 @@ TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) {
EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
}
+
+// Tests that the logic to show the access Address Book prompt respects the
+// preference that indicates the total number of times the prompt has already
+// been shown.
+TEST_F(PersonalDataManagerTest, MaxTimesToShowAddressBookPrompt) {
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(1);
+
+ AutofillType type(ADDRESS_HOME_STREET_ADDRESS);
+
+ prefs_->SetBoolean(prefs::kAutofillEnabled, true);
+ EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
+
+ prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 4);
+ EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
+
+ prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 6);
+ EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
+}
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/personal_data_manager_mac.mm ('k') | components/autofill/core/common/autofill_pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698