| 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 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", | 2694 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", |
| 2695 "91601", "US", "12345678910"); | 2695 "91601", "US", "12345678910"); |
| 2696 personal_data_->AddProfile(profile); | 2696 personal_data_->AddProfile(profile); |
| 2697 | 2697 |
| 2698 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2698 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
| 2699 .WillOnce(QuitMainMessageLoop()); | 2699 .WillOnce(QuitMainMessageLoop()); |
| 2700 base::MessageLoop::current()->Run(); | 2700 base::MessageLoop::current()->Run(); |
| 2701 | 2701 |
| 2702 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); | 2702 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
| 2703 } | 2703 } |
| 2704 |
| 2705 // Tests that the logic to show the access Address Book prompt respects the |
| 2706 // preference that indicates the total number of times the prompt has already |
| 2707 // been shown. |
| 2708 TEST_F(PersonalDataManagerTest, MaxTimesToShowAddressBookPrompt) { |
| 2709 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(1); |
| 2710 |
| 2711 AutofillType type(ADDRESS_HOME_STREET_ADDRESS); |
| 2712 |
| 2713 prefs_->SetBoolean(prefs::kAutofillEnabled, true); |
| 2714 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
| 2715 |
| 2716 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 4); |
| 2717 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
| 2718 |
| 2719 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 6); |
| 2720 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
| 2721 } |
| 2704 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 2722 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 2705 | 2723 |
| 2706 } // namespace autofill | 2724 } // namespace autofill |
| OLD | NEW |