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

Side by Side Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 948203002: Change autofill credit card suggestion text on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android tests? (trouble testing locally :() Created 5 years, 9 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
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <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/command_line.h" 10 #include "base/command_line.h"
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 "https://www.example.com"); 2726 "https://www.example.com");
2727 credit_card2.set_use_count(1); 2727 credit_card2.set_use_count(1);
2728 test::SetCreditCardInfo(&credit_card2, 2728 test::SetCreditCardInfo(&credit_card2,
2729 "Bonnie Parker", "518765432109" /* Mastercard */, "", ""); 2729 "Bonnie Parker", "518765432109" /* Mastercard */, "", "");
2730 personal_data_->AddCreditCard(credit_card2); 2730 personal_data_->AddCreditCard(credit_card2);
2731 2731
2732 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) 2732 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
2733 .WillOnce(QuitMainMessageLoop()); 2733 .WillOnce(QuitMainMessageLoop());
2734 base::MessageLoop::current()->Run(); 2734 base::MessageLoop::current()->Run();
2735 2735
2736 // Sublabel is card number when filling name. 2736 // Sublabel is card number when filling name (exact format depends on
2737 // the platform, but the last 4 digits should appear).
2737 std::vector<Suggestion> suggestions = 2738 std::vector<Suggestion> suggestions =
2738 personal_data_->GetCreditCardSuggestions( 2739 personal_data_->GetCreditCardSuggestions(
2739 AutofillType(CREDIT_CARD_NAME), base::string16()); 2740 AutofillType(CREDIT_CARD_NAME), base::string16());
2740 ASSERT_EQ(3U, suggestions.size()); 2741 ASSERT_EQ(3U, suggestions.size());
2741 // Ordered by MFU. 2742 // Ordered by MFU.
2742 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value); 2743 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[1].value);
2743 EXPECT_EQ(ASCIIToUTF16("*8555"), suggestions[1].label); 2744 EXPECT_TRUE(suggestions[1].label.find(ASCIIToUTF16("8555")) !=
2745 base::string16::npos);
2744 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value); 2746 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value);
2745 EXPECT_EQ(base::string16(), suggestions[0].label); 2747 EXPECT_EQ(base::string16(), suggestions[0].label);
2746 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value); 2748 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value);
2747 EXPECT_EQ(ASCIIToUTF16("*2109"), suggestions[2].label); 2749 EXPECT_TRUE(suggestions[2].label.find(ASCIIToUTF16("2109")) !=
2750 base::string16::npos);
2748 2751
2749 // Sublabel is expiration date when filling card number. 2752 // Sublabel is expiration date when filling card number.
2750 suggestions = personal_data_->GetCreditCardSuggestions( 2753 suggestions = personal_data_->GetCreditCardSuggestions(
2751 AutofillType(CREDIT_CARD_NUMBER), base::string16()); 2754 AutofillType(CREDIT_CARD_NUMBER), base::string16());
2752 ASSERT_EQ(2U, suggestions.size()); 2755 ASSERT_EQ(2U, suggestions.size());
2753 EXPECT_EQ(ASCIIToUTF16("Amex - 8555"), suggestions[0].value); 2756 EXPECT_EQ(ASCIIToUTF16("Amex - 8555"), suggestions[0].value);
2754 EXPECT_EQ(ASCIIToUTF16("04/15"), suggestions[0].label); 2757 EXPECT_EQ(ASCIIToUTF16("04/15"), suggestions[0].label);
2755 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[1].value); 2758 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[1].value);
2756 EXPECT_EQ(base::string16(), suggestions[1].label); 2759 EXPECT_EQ(base::string16(), suggestions[1].label);
2757 2760
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 EXPECT_NE(base::Time(), personal_data_->GetCreditCards()[0]->use_date()); 2991 EXPECT_NE(base::Time(), personal_data_->GetCreditCards()[0]->use_date());
2989 2992
2990 EXPECT_EQ(0U, personal_data_->GetCreditCards()[1]->use_count()); 2993 EXPECT_EQ(0U, personal_data_->GetCreditCards()[1]->use_count());
2991 EXPECT_EQ(base::Time(), personal_data_->GetCreditCards()[1]->use_date()); 2994 EXPECT_EQ(base::Time(), personal_data_->GetCreditCards()[1]->use_date());
2992 2995
2993 EXPECT_EQ(1U, personal_data_->GetCreditCards()[2]->use_count()); 2996 EXPECT_EQ(1U, personal_data_->GetCreditCards()[2]->use_count());
2994 EXPECT_NE(base::Time(), personal_data_->GetCreditCards()[2]->use_date()); 2997 EXPECT_NE(base::Time(), personal_data_->GetCreditCards()[2]->use_date());
2995 } 2998 }
2996 2999
2997 } // namespace autofill 3000 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698