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

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

Issue 15697010: Autofill:requestAutocomplete: Enable prompting for complete address when instrument being used does… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head instead of using lkgr Created 7 years, 7 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 92de86c90e3730bc74b7493789179bf464aebc08..fc43f4f51357e37cff67798699b3d20128c77585 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -222,6 +222,11 @@ class TestAutofillDialogController
void set_dialog_type(DialogType dialog_type) { dialog_type_ = dialog_type; }
+ bool IsSectionInEditState(DialogSection section) {
+ std::map<DialogSection, bool> state = section_editing_state();
+ return state[section];
+ }
+
protected:
virtual PersonalDataManager* GetManager() OVERRIDE {
return &test_manager_;
@@ -672,11 +677,13 @@ TEST_F(AutofillDialogControllerTest, WalletDefaultItems) {
controller()->MenuModelForSection(SECTION_CC_BILLING)->GetItemCount());
EXPECT_TRUE(controller()->MenuModelForSection(SECTION_CC_BILLING)->
IsItemCheckedAt(2));
+ ASSERT_FALSE(controller()->IsSectionInEditState(SECTION_CC_BILLING));
// "use billing", "add", "manage", and 5 suggestions.
EXPECT_EQ(8,
controller()->MenuModelForSection(SECTION_SHIPPING)->GetItemCount());
EXPECT_TRUE(controller()->MenuModelForSection(SECTION_SHIPPING)->
IsItemCheckedAt(4));
+ ASSERT_FALSE(controller()->IsSectionInEditState(SECTION_SHIPPING));
}
// Tests that invalid and AMEX default instruments are ignored.
@@ -1404,4 +1411,21 @@ TEST_F(AutofillDialogControllerTest, SaveDetailsInChrome) {
EXPECT_FALSE(controller()->ShouldOfferToSaveInChrome());
}
+// Tests that user is prompted when using instrument with minimal address.
+TEST_F(AutofillDialogControllerTest, UpgradeMinimalAddress) {
+ scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems();
+ wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentWithIdAndAddress(
+ "id", wallet::GetTestMinimalAddress()));
+ scoped_ptr<wallet::Address> address(wallet::GetTestShippingAddress());
+ address->set_is_complete_address(false);
+ wallet_items->AddAddress(address.Pass());
+ controller()->OnDidGetWalletItems(wallet_items.Pass());
+
+ // Assert that dialog's SECTION_CC_BILLING section is in edit mode.
+ ASSERT_TRUE(controller()->IsSectionInEditState(SECTION_CC_BILLING));
+ // Shipping section should be in edit mode because of
+ // is_minimal_shipping_address.
+ ASSERT_TRUE(controller()->IsSectionInEditState(SECTION_SHIPPING));
+}
+
} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/data_model_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698