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

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

Issue 575283003: mac: Don't show access Address Book prompt if user has any Autofill state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix another unit test. Fix some broken (unused) logic in that unit test. 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 20e10f2499008e3f76582e611306008cd1ef1997..0b537bbefe2cd597b7ff066be1963cb8f1856788 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -2681,10 +2681,24 @@ TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) {
AutofillType type(ADDRESS_HOME_STREET_ADDRESS);
+ prefs_->SetBoolean(prefs::kAutofillEnabled, false);
+ EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
+
prefs_->SetBoolean(prefs::kAutofillEnabled, true);
EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
- prefs_->SetBoolean(prefs::kAutofillEnabled, false);
+ // Adding an Autofill Profile should prevent the prompt from appearing.
+ AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/");
+ test::SetProfileInfo(&profile,
+ "Marion", "Mitchell", "Morrison",
+ "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
+ "91601", "US", "12345678910");
+ personal_data_->AddProfile(profile);
+
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
+ .WillOnce(QuitMainMessageLoop());
+ base::MessageLoop::current()->Run();
+
EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
}
#endif // defined(OS_MACOSX) && !defined(OS_IOS)

Powered by Google App Engine
This is Rietveld 408576698