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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 14571003: Don't display drop down arrows in rAc dialog unless there is a suggestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dont break android Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
index c1a3c0d735385d9662192de5d4298f3141125855..d6b651051e397ac1c91883c58bd9dec31e40daa2 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -363,6 +363,11 @@ TEST_F(AutofillDialogControllerTest, AutofillProfiles) {
// Since the PersonalDataManager is empty, this should only have the
// "use billing", "add new" and "manage" menu items.
EXPECT_EQ(3, shipping_model->GetItemCount());
+ // On the other hand, the other models should be NULL when there's no
+ // suggestion.
+ EXPECT_FALSE(controller()->MenuModelForSection(SECTION_CC));
+ EXPECT_FALSE(controller()->MenuModelForSection(SECTION_BILLING));
+ EXPECT_FALSE(controller()->MenuModelForSection(SECTION_EMAIL));
EXPECT_CALL(*controller()->GetView(), ModelChanged()).Times(2);
@@ -372,6 +377,7 @@ TEST_F(AutofillDialogControllerTest, AutofillProfiles) {
controller()->GetTestingManager()->AddTestingProfile(&empty_profile);
shipping_model = controller()->MenuModelForSection(SECTION_SHIPPING);
EXPECT_EQ(3, shipping_model->GetItemCount());
+ EXPECT_FALSE(controller()->MenuModelForSection(SECTION_EMAIL));
// A full profile should be picked up.
AutofillProfile full_profile(test::GetFullProfile());
@@ -379,13 +385,14 @@ TEST_F(AutofillDialogControllerTest, AutofillProfiles) {
controller()->GetTestingManager()->AddTestingProfile(&full_profile);
shipping_model = controller()->MenuModelForSection(SECTION_SHIPPING);
EXPECT_EQ(4, shipping_model->GetItemCount());
+ EXPECT_TRUE(!!controller()->MenuModelForSection(SECTION_EMAIL));
}
TEST_F(AutofillDialogControllerTest, AutofillProfileVariants) {
EXPECT_CALL(*controller()->GetView(), ModelChanged()).Times(1);
ui::MenuModel* email_model =
controller()->MenuModelForSection(SECTION_EMAIL);
- EXPECT_EQ(2, email_model->GetItemCount());
+ EXPECT_FALSE(email_model);
// Set up some variant data.
AutofillProfile full_profile(test::GetFullProfile());
@@ -406,6 +413,7 @@ TEST_F(AutofillDialogControllerTest, AutofillProfileVariants) {
controller()->MenuModelForSection(SECTION_SHIPPING);
EXPECT_EQ(4, shipping_model->GetItemCount());
email_model = controller()->MenuModelForSection(SECTION_EMAIL);
+ ASSERT_TRUE(!!email_model);
EXPECT_EQ(4, email_model->GetItemCount());
email_model->ActivatedAt(0);
@@ -637,8 +645,7 @@ TEST_F(AutofillDialogControllerTest, VerifyCvv) {
suggestion_state =
controller()->SuggestionStateForSection(SECTION_CC_BILLING);
EXPECT_FALSE(suggestion_state.extra_text.empty());
- EXPECT_EQ(
- 0, controller()->MenuModelForSection(SECTION_CC_BILLING)->GetItemCount());
+ EXPECT_FALSE(controller()->MenuModelForSection(SECTION_CC_BILLING));
EXPECT_TRUE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
EXPECT_TRUE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL));

Powered by Google App Engine
This is Rietveld 408576698