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

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

Issue 15979002: Making credit card number un-editable in Wallet mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
index fea5ef9253876ef05cc073d8ec86e7ba0fd5d8e1..c0a631394995769adf565e58d85d4d161945ce3c 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_browsertest.cc
@@ -17,6 +17,7 @@
#include "components/autofill/browser/autofill_common_test.h"
#include "components/autofill/browser/autofill_metrics.h"
#include "components/autofill/browser/test_personal_data_manager.h"
+#include "components/autofill/browser/wallet/wallet_test_util.h"
#include "components/autofill/common/form_data.h"
#include "components/autofill/common/form_field_data.h"
#include "content/public/test/test_utils.h"
@@ -87,9 +88,7 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl {
dialog_type,
base::Bind(&MockCallback)),
metric_logger_(metric_logger),
- message_loop_runner_(runner) {
- DisableWallet();
- }
+ message_loop_runner_(runner) {}
virtual ~TestAutofillDialogController() {}
@@ -126,6 +125,8 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl {
return &test_manager_;
}
+ using AutofillDialogControllerImpl::DisableWallet;
+
protected:
virtual PersonalDataManager* GetManager() OVERRIDE {
return &test_manager_;
@@ -266,6 +267,7 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, AutocheckoutError) {
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, FillInputFromAutofill) {
InitializeControllerOfType(DIALOG_TYPE_REQUEST_AUTOCOMPLETE);
+ controller()->DisableWallet();
AutofillProfile full_profile(test::GetFullProfile());
controller()->GetTestingManager()->AddTestingProfile(&full_profile);
@@ -343,6 +345,7 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest,
// expected when Autofill is used to fill text inputs.
IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, FillComboboxFromAutofill) {
InitializeControllerOfType(DIALOG_TYPE_REQUEST_AUTOCOMPLETE);
+ controller()->DisableWallet();
CreditCard card1;
test::SetCreditCardInfo(&card1, "JJ Smith", "4111111111111111", "12", "2018");
@@ -424,6 +427,44 @@ IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, FillComboboxFromAutofill) {
}
}
}
+
+// Tests that credit card number is disabled while editing a Wallet instrument.
+IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, WalletCreditCardDisabled) {
+ InitializeControllerOfType(DIALOG_TYPE_REQUEST_AUTOCOMPLETE);
+ controller()->OnUserNameFetchSuccess("user@example.com");
+
+ scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems();
+ wallet_items->AddInstrument(wallet::GetTestMaskedInstrument());
+ controller()->OnDidGetWalletItems(wallet_items.Pass());
+
+ // Click "Edit" in the billing section (while using Wallet).
+ controller()->EditClickedForSection(SECTION_CC_BILLING);
+
+ const DetailInputs& edit_inputs =
+ controller()->RequestedFieldsForSection(SECTION_CC_BILLING);
+ size_t i;
+ for (i = 0; i < edit_inputs.size(); ++i) {
+ if (edit_inputs[i].type == CREDIT_CARD_NUMBER) {
+ EXPECT_FALSE(edit_inputs[i].editable);
+ break;
+ }
+ }
+ ASSERT_LT(i, edit_inputs.size());
+
+ // Select "Add new billing info..." while using Wallet.
+ ui::MenuModel* model = controller()->MenuModelForSection(SECTION_CC_BILLING);
+ model->ActivatedAt(model->GetItemCount() - 2);
+
+ const DetailInputs& add_inputs =
+ controller()->RequestedFieldsForSection(SECTION_CC_BILLING);
+ for (i = 0; i < add_inputs.size(); ++i) {
+ if (add_inputs[i].type == CREDIT_CARD_NUMBER) {
+ EXPECT_TRUE(add_inputs[i].editable);
+ break;
+ }
+ }
+ ASSERT_LT(i, add_inputs.size());
+}
#endif // defined(TOOLKIT_VIEWS)
} // namespace autofill
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698