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

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

Issue 25620002: [rac] Use i18n address inputs with --enable-autofill-address-i18n flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid initializer list Created 7 years, 2 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 | « chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..12c8a2ab81bc875cb30d7cbd322b1952459d09f4
--- /dev/null
+++ b/chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc
@@ -0,0 +1,69 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Unit tests for generation of internationalized address input forms. Only US
+// addresses are tested until libaddressinput is integrated.
+
+#include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace autofill {
+namespace i18ninput {
+
+namespace {
+
+const size_t kNumberOfAdderssLinesUS = 7;
+
+} // namespace
+
+TEST(AutofillDialogI18nInput, I18nAddressInputIsDisabledByDefault) {
+ EXPECT_FALSE(IsI18nAddressInputEnabled());
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ::switches::kEnableAutofillAddressInternationalization);
+ EXPECT_TRUE(IsI18nAddressInputEnabled());
+}
+
+TEST(AutofillDialogI18nInput, USShippingAddress) {
+ DetailInputs inputs;
+ BuildI18nInputs(ADDRESS_TYPE_SHIPPING, "US", 0, &inputs);
+
+ ASSERT_EQ(kNumberOfAdderssLinesUS, inputs.size());
+ EXPECT_EQ(NAME_FULL, inputs[0].type);
+ EXPECT_EQ(ADDRESS_HOME_COUNTRY, inputs[kNumberOfAdderssLinesUS - 1].type);
+}
+
+TEST(AutofillDialogI18nInput, USBillingAddress) {
+ DetailInputs inputs;
+ BuildI18nInputs(ADDRESS_TYPE_BILLING, "US", 0, &inputs);
+
+ ASSERT_EQ(kNumberOfAdderssLinesUS, inputs.size());
+ EXPECT_EQ(NAME_BILLING_FULL, inputs[0].type);
+ EXPECT_EQ(ADDRESS_BILLING_COUNTRY, inputs[kNumberOfAdderssLinesUS - 1].type);
+}
+
+TEST(AutofillDialogI18nInput, USStateAndZipCodeShareInputRow) {
+ static const int kStateInputIndex = 4;
+ static const int kZipCodeInputIndex = 5;
+
+ DetailInputs inputs;
+ BuildI18nInputs(ADDRESS_TYPE_SHIPPING, "US", 0, &inputs);
+
+ ASSERT_EQ(kNumberOfAdderssLinesUS, inputs.size());
+
+ EXPECT_EQ(ADDRESS_HOME_STATE, inputs[kStateInputIndex].type);
+ EXPECT_EQ(ADDRESS_HOME_ZIP, inputs[kZipCodeInputIndex].type);
+
+ EXPECT_EQ(inputs[kStateInputIndex].row_id, inputs[kZipCodeInputIndex].row_id);
+
+ EXPECT_NE(inputs[kStateInputIndex].row_id,
+ inputs[kStateInputIndex - 1].row_id);
+ EXPECT_NE(inputs[kZipCodeInputIndex].row_id,
+ inputs[kZipCodeInputIndex + 1].row_id);
+}
+
+} // namespace i18ninput
+} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698