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

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

Issue 936273002: Shorten "American Express" to "Amex" in Chrome UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gclient sync Created 5 years, 10 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/credit_card.cc ('k') | components/autofill_strings.grdp » ('j') | 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 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 EXPECT_EQ(ASCIIToUTF16("*8555"), suggestions[1].label); 2743 EXPECT_EQ(ASCIIToUTF16("*8555"), suggestions[1].label);
2744 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value); 2744 EXPECT_EQ(ASCIIToUTF16("John Dillinger"), suggestions[0].value);
2745 EXPECT_EQ(base::string16(), suggestions[0].label); 2745 EXPECT_EQ(base::string16(), suggestions[0].label);
2746 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value); 2746 EXPECT_EQ(ASCIIToUTF16("Bonnie Parker"), suggestions[2].value);
2747 EXPECT_EQ(ASCIIToUTF16("*2109"), suggestions[2].label); 2747 EXPECT_EQ(ASCIIToUTF16("*2109"), suggestions[2].label);
2748 2748
2749 // Sublabel is expiration date when filling card number. 2749 // Sublabel is expiration date when filling card number.
2750 suggestions = personal_data_->GetCreditCardSuggestions( 2750 suggestions = personal_data_->GetCreditCardSuggestions(
2751 AutofillType(CREDIT_CARD_NUMBER), base::string16()); 2751 AutofillType(CREDIT_CARD_NUMBER), base::string16());
2752 ASSERT_EQ(2U, suggestions.size()); 2752 ASSERT_EQ(2U, suggestions.size());
2753 EXPECT_EQ(ASCIIToUTF16("American Express - 8555"), suggestions[0].value); 2753 EXPECT_EQ(ASCIIToUTF16("Amex - 8555"), suggestions[0].value);
2754 EXPECT_EQ(ASCIIToUTF16("04/15"), suggestions[0].label); 2754 EXPECT_EQ(ASCIIToUTF16("04/15"), suggestions[0].label);
2755 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[1].value); 2755 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[1].value);
2756 EXPECT_EQ(base::string16(), suggestions[1].label); 2756 EXPECT_EQ(base::string16(), suggestions[1].label);
2757 2757
2758 // Add some server cards. If there are local dupes, the locals should be 2758 // Add some server cards. If there are local dupes, the locals should be
2759 // hidden. 2759 // hidden.
2760 std::vector<CreditCard> server_cards; 2760 std::vector<CreditCard> server_cards;
2761 // This server card matches a local card, except the local card is missing the 2761 // This server card matches a local card, except the local card is missing the
2762 // number. This should count as a dupe. 2762 // number. This should count as a dupe.
2763 server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "a123")); 2763 server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "a123"));
(...skipping 30 matching lines...) Expand all
2794 EXPECT_NE(suggestions[2].backend_id.guid, credit_card2.guid()); 2794 EXPECT_NE(suggestions[2].backend_id.guid, credit_card2.guid());
2795 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[3].value); 2795 EXPECT_EQ(ASCIIToUTF16("Clyde Barrow"), suggestions[3].value);
2796 EXPECT_NE(suggestions[0].backend_id.guid, credit_card0.guid()); 2796 EXPECT_NE(suggestions[0].backend_id.guid, credit_card0.guid());
2797 2797
2798 suggestions = personal_data_->GetCreditCardSuggestions( 2798 suggestions = personal_data_->GetCreditCardSuggestions(
2799 AutofillType(CREDIT_CARD_NUMBER), base::string16()); 2799 AutofillType(CREDIT_CARD_NUMBER), base::string16());
2800 ASSERT_EQ(4U, suggestions.size()); 2800 ASSERT_EQ(4U, suggestions.size());
2801 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[0].value); 2801 EXPECT_EQ(ASCIIToUTF16("MasterCard - 2109"), suggestions[0].value);
2802 EXPECT_EQ(ASCIIToUTF16("Visa - 9012"), suggestions[1].value); 2802 EXPECT_EQ(ASCIIToUTF16("Visa - 9012"), suggestions[1].value);
2803 EXPECT_EQ(ASCIIToUTF16("Visa - 2109"), suggestions[2].value); 2803 EXPECT_EQ(ASCIIToUTF16("Visa - 2109"), suggestions[2].value);
2804 EXPECT_EQ(ASCIIToUTF16("American Express - 8555"), suggestions[3].value); 2804 EXPECT_EQ(ASCIIToUTF16("Amex - 8555"), suggestions[3].value);
2805 2805
2806 // Make sure a server card can be a dupe of more than one local card. 2806 // Make sure a server card can be a dupe of more than one local card.
2807 CreditCard credit_card3("4141084B-72D7-4B73-90CF-3D6AC154673B", 2807 CreditCard credit_card3("4141084B-72D7-4B73-90CF-3D6AC154673B",
2808 "https://www.example.com"); 2808 "https://www.example.com");
2809 test::SetCreditCardInfo(&credit_card3, "John Dillinger", "", "01", ""); 2809 test::SetCreditCardInfo(&credit_card3, "John Dillinger", "", "01", "");
2810 personal_data_->AddCreditCard(credit_card3); 2810 personal_data_->AddCreditCard(credit_card3);
2811 2811
2812 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) 2812 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
2813 .WillOnce(QuitMainMessageLoop()); 2813 .WillOnce(QuitMainMessageLoop());
2814 base::MessageLoop::current()->Run(); 2814 base::MessageLoop::current()->Run();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 EXPECT_NE(base::Time(), added_profile->modification_date()); 2918 EXPECT_NE(base::Time(), added_profile->modification_date());
2919 2919
2920 added_card = personal_data_->GetCreditCardByGUID(credit_card.guid()); 2920 added_card = personal_data_->GetCreditCardByGUID(credit_card.guid());
2921 ASSERT_TRUE(added_card); 2921 ASSERT_TRUE(added_card);
2922 EXPECT_EQ(1U, added_card->use_count()); 2922 EXPECT_EQ(1U, added_card->use_count());
2923 EXPECT_NE(base::Time(), added_card->use_date()); 2923 EXPECT_NE(base::Time(), added_card->use_date());
2924 EXPECT_NE(base::Time(), added_card->modification_date()); 2924 EXPECT_NE(base::Time(), added_card->modification_date());
2925 } 2925 }
2926 2926
2927 } // namespace autofill 2927 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698