OLD | NEW |
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 Loading... |
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 |
OLD | NEW |