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

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
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 3213d8267d1885476b70ba5024c0be511a7af6f6..ecf88e9ebf44d2edb8c5dad9e57864a4d726884b 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"
@@ -88,7 +89,6 @@ class TestAutofillDialogController : public AutofillDialogControllerImpl {
base::Bind(&MockCallback)),
metric_logger_(metric_logger),
message_loop_runner_(runner) {
Evan Stade 2013/05/25 00:41:19 {} on same line
Dan Beam 2013/05/25 02:36:57 Done.
- DisableWallet();
}
virtual ~TestAutofillDialogController() {}
@@ -418,6 +418,36 @@ 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());
+
+ controller()->EditClickedForSection(SECTION_CC_BILLING);
+
+ const DetailInputs& inputs =
+ controller()->RequestedFieldsForSection(SECTION_CC_BILLING);
+ size_t i;
+ for (i = 0; i < inputs.size(); ++i) {
+ if (inputs[i].type == CREDIT_CARD_NUMBER) {
+ EXPECT_FALSE(inputs[i].enabled);
+ break;
+ }
+ }
+ ASSERT_LT(i, inputs.size());
+
+ DetailOutputMap output;
+ controller()->view()->GetUserInput(SECTION_CC_BILLING, &output);
+ for (DetailOutputMap::const_iterator it = output.begin(); it != output.end();
+ ++it) {
Evan Stade 2013/05/25 00:41:19 one more space of indent
Dan Beam 2013/05/25 02:36:57 removed
+ EXPECT_NE(CREDIT_CARD_NUMBER, it->first->type);
+ }
+}
#endif // defined(TOOLKIT_VIEWS)
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698