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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 EXPECT_EQ(ASCIIToUTF16("********2109"), values[1]); 2674 EXPECT_EQ(ASCIIToUTF16("********2109"), values[1]);
2675 EXPECT_EQ(base::string16(), labels[1]); 2675 EXPECT_EQ(base::string16(), labels[1]);
2676 } 2676 }
2677 2677
2678 #if defined(OS_MACOSX) && !defined(OS_IOS) 2678 #if defined(OS_MACOSX) && !defined(OS_IOS)
2679 TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) { 2679 TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) {
2680 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(2); 2680 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(2);
2681 2681
2682 AutofillType type(ADDRESS_HOME_STREET_ADDRESS); 2682 AutofillType type(ADDRESS_HOME_STREET_ADDRESS);
2683 2683
2684 prefs_->SetBoolean(prefs::kAutofillEnabled, false);
2685 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
2686
2684 prefs_->SetBoolean(prefs::kAutofillEnabled, true); 2687 prefs_->SetBoolean(prefs::kAutofillEnabled, true);
2685 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); 2688 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
2686 2689
2687 prefs_->SetBoolean(prefs::kAutofillEnabled, false); 2690 // Adding an Autofill Profile should prevent the prompt from appearing.
2691 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/");
2692 test::SetProfileInfo(&profile,
2693 "Marion", "Mitchell", "Morrison",
2694 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
2695 "91601", "US", "12345678910");
2696 personal_data_->AddProfile(profile);
2697
2698 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
2699 .WillOnce(QuitMainMessageLoop());
2700 base::MessageLoop::current()->Run();
2701
2688 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); 2702 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type));
2689 } 2703 }
2690 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 2704 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
2691 2705
2692 } // namespace autofill 2706 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698