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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 1153663004: [Autofill] Remove (most) support for variants in chrome/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 controller()->GetTestingManager()->AddTestingProfile(&new_profile); 1117 controller()->GetTestingManager()->AddTestingProfile(&new_profile);
1118 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card); 1118 controller()->GetTestingManager()->AddTestingCreditCard(&credit_card);
1119 controller()->GetTestingManager()->AddTestingCreditCard(&new_credit_card); 1119 controller()->GetTestingManager()->AddTestingCreditCard(&new_credit_card);
1120 1120
1121 // Until a selection has been made, the default suggestion is the first one. 1121 // Until a selection has been made, the default suggestion is the first one.
1122 // For the shipping section, this follows the "use billing" suggestion. 1122 // For the shipping section, this follows the "use billing" suggestion.
1123 EXPECT_EQ(1, GetMenuModelForSection(SECTION_CC)->checked_item()); 1123 EXPECT_EQ(1, GetMenuModelForSection(SECTION_CC)->checked_item());
1124 EXPECT_EQ(2, GetMenuModelForSection(SECTION_SHIPPING)->checked_item()); 1124 EXPECT_EQ(2, GetMenuModelForSection(SECTION_SHIPPING)->checked_item());
1125 } 1125 }
1126 1126
1127 TEST_F(AutofillDialogControllerTest, AutofillProfileVariants) {
1128 SwitchToAutofill();
1129 EXPECT_CALL(*controller()->GetView(), ModelChanged());
1130 ui::MenuModel* shipping_model =
1131 controller()->MenuModelForSection(SECTION_SHIPPING);
1132 ASSERT_TRUE(shipping_model);
1133 EXPECT_EQ(3, shipping_model->GetItemCount());
1134
1135 // Set up some variant data.
1136 AutofillProfile full_profile(test::GetVerifiedProfile());
1137 std::vector<base::string16> names;
1138 names.push_back(ASCIIToUTF16("John Doe"));
1139 names.push_back(ASCIIToUTF16("Jane Doe"));
1140 full_profile.SetRawMultiInfo(NAME_FULL, names);
1141 std::vector<base::string16> emails;
1142 emails.push_back(ASCIIToUTF16(kFakeEmail));
1143 emails.push_back(ASCIIToUTF16("admin@example.com"));
1144 full_profile.SetRawMultiInfo(EMAIL_ADDRESS, emails);
1145
1146 // Non-default variants are ignored by the dialog.
1147 controller()->GetTestingManager()->AddTestingProfile(&full_profile);
1148 EXPECT_EQ(4, shipping_model->GetItemCount());
1149 }
1150
1151 TEST_F(AutofillDialogControllerTest, SuggestValidEmail) { 1127 TEST_F(AutofillDialogControllerTest, SuggestValidEmail) {
1152 SwitchToAutofill(); 1128 SwitchToAutofill();
1153 AutofillProfile profile(test::GetVerifiedProfile()); 1129 AutofillProfile profile(test::GetVerifiedProfile());
1154 const base::string16 kValidEmail = ASCIIToUTF16(kFakeEmail); 1130 const base::string16 kValidEmail = ASCIIToUTF16(kFakeEmail);
1155 profile.SetRawInfo(EMAIL_ADDRESS, kValidEmail); 1131 profile.SetRawInfo(EMAIL_ADDRESS, kValidEmail);
1156 controller()->GetTestingManager()->AddTestingProfile(&profile); 1132 controller()->GetTestingManager()->AddTestingProfile(&profile);
1157 1133
1158 // "add", "manage", and 1 suggestion. 1134 // "add", "manage", and 1 suggestion.
1159 EXPECT_EQ( 1135 EXPECT_EQ(
1160 3, controller()->MenuModelForSection(SECTION_BILLING)->GetItemCount()); 1136 3, controller()->MenuModelForSection(SECTION_BILLING)->GetItemCount());
(...skipping 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after
3637 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); 3613 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value);
3638 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3614 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3639 form_structure()->field(3)->Type().GetStorableType()); 3615 form_structure()->field(3)->Type().GetStorableType());
3640 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); 3616 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value);
3641 EXPECT_EQ(ADDRESS_HOME_COUNTRY, 3617 EXPECT_EQ(ADDRESS_HOME_COUNTRY,
3642 form_structure()->field(4)->Type().GetStorableType()); 3618 form_structure()->field(4)->Type().GetStorableType());
3643 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); 3619 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value);
3644 } 3620 }
3645 3621
3646 } // namespace autofill 3622 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc ('k') | chrome/browser/ui/autofill/data_model_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698