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

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: sync 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 0c7532a91c794a0846ac293738187788634885bc..25c3a2b4e10d191cf5d31d70bc19173d9bd01929 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -366,6 +366,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);
@@ -375,6 +380,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());
@@ -383,13 +389,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());
@@ -410,6 +417,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);
@@ -631,8 +639,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