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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 &values, | 2691 &values, |
2692 &labels, | 2692 &labels, |
2693 &icons, | 2693 &icons, |
2694 &guid_pairs); | 2694 &guid_pairs); |
2695 ASSERT_EQ(2U, values.size()); | 2695 ASSERT_EQ(2U, values.size()); |
2696 ASSERT_EQ(values.size(), labels.size()); | 2696 ASSERT_EQ(values.size(), labels.size()); |
2697 EXPECT_EQ(ASCIIToUTF16("********8555"), values[0]); | 2697 EXPECT_EQ(ASCIIToUTF16("********8555"), values[0]); |
2698 EXPECT_EQ(ASCIIToUTF16("04/15"), labels[0]); | 2698 EXPECT_EQ(ASCIIToUTF16("04/15"), labels[0]); |
2699 EXPECT_EQ(ASCIIToUTF16("********2109"), values[1]); | 2699 EXPECT_EQ(ASCIIToUTF16("********2109"), values[1]); |
2700 EXPECT_EQ(base::string16(), labels[1]); | 2700 EXPECT_EQ(base::string16(), labels[1]); |
| 2701 |
| 2702 // Retrieve suggetions without obfuscating the card number. |
| 2703 values.clear(); |
| 2704 labels.clear(); |
| 2705 icons.clear(); |
| 2706 guid_pairs.clear(); |
| 2707 personal_data_->GetCreditCardSuggestions(AutofillType(CREDIT_CARD_NUMBER), |
| 2708 base::string16(), |
| 2709 &values, |
| 2710 &labels, |
| 2711 &icons, |
| 2712 &guid_pairs, |
| 2713 false); |
| 2714 ASSERT_EQ(2U, values.size()); |
| 2715 ASSERT_EQ(values.size(), labels.size()); |
| 2716 EXPECT_EQ(ASCIIToUTF16("347666888555"), values[0]); |
| 2717 EXPECT_EQ(ASCIIToUTF16("04/15"), labels[0]); |
| 2718 EXPECT_EQ(ASCIIToUTF16("518765432109"), values[1]); |
| 2719 EXPECT_EQ(base::string16(), labels[1]); |
2701 } | 2720 } |
2702 | 2721 |
2703 #if defined(OS_MACOSX) && !defined(OS_IOS) | 2722 #if defined(OS_MACOSX) && !defined(OS_IOS) |
2704 TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) { | 2723 TEST_F(PersonalDataManagerTest, ShowAddressBookPrompt) { |
2705 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(2); | 2724 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()).Times(2); |
2706 | 2725 |
2707 AutofillType type(ADDRESS_HOME_STREET_ADDRESS); | 2726 AutofillType type(ADDRESS_HOME_STREET_ADDRESS); |
2708 | 2727 |
2709 prefs_->SetBoolean(prefs::kAutofillEnabled, false); | 2728 prefs_->SetBoolean(prefs::kAutofillEnabled, false); |
2710 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); | 2729 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
(...skipping 29 matching lines...) Expand all Loading... |
2740 | 2759 |
2741 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 4); | 2760 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 4); |
2742 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); | 2761 EXPECT_TRUE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
2743 | 2762 |
2744 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 6); | 2763 prefs_->SetInteger(prefs::kAutofillMacAddressBookShowedCount, 6); |
2745 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); | 2764 EXPECT_FALSE(personal_data_->ShouldShowAccessAddressBookSuggestion(type)); |
2746 } | 2765 } |
2747 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 2766 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
2748 | 2767 |
2749 } // namespace autofill | 2768 } // namespace autofill |
OLD | NEW |