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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_i18n_input_unittest.cc

Issue 63053003: Ask libaddressinput for address components to use in requestAutocomplete(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: let's try this again, android Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Unit tests for generation of internationalized address input forms. Only US
6 // addresses are tested until libaddressinput is integrated.
7
8 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
9
10 #include "base/command_line.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace autofill {
15 namespace i18ninput {
16
17 namespace {
18
19 const size_t kNumberOfAddressLinesUS = 7;
20
21 } // namespace
22
23 TEST(AutofillDialogI18nInput, I18nAddressInputIsDisabledByDefault) {
24 EXPECT_FALSE(IsI18nAddressInputEnabled());
25 CommandLine::ForCurrentProcess()->AppendSwitch(
26 ::switches::kEnableAutofillAddressInternationalization);
27 EXPECT_TRUE(IsI18nAddressInputEnabled());
28 }
29
30 TEST(AutofillDialogI18nInput, USShippingAddress) {
31 DetailInputs inputs;
32 BuildI18nInputs(ADDRESS_TYPE_SHIPPING, "US", 0, &inputs);
33
34 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
35 EXPECT_EQ(NAME_FULL, inputs[0].type);
36 EXPECT_EQ(ADDRESS_HOME_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
37 }
38
39 TEST(AutofillDialogI18nInput, USBillingAddress) {
40 DetailInputs inputs;
41 BuildI18nInputs(ADDRESS_TYPE_BILLING, "US", 0, &inputs);
42
43 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
44 EXPECT_EQ(NAME_BILLING_FULL, inputs[0].type);
45 EXPECT_EQ(ADDRESS_BILLING_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
46 }
47
48 TEST(AutofillDialogI18nInput, USCityStateAndZipCodeShareInputRow) {
49 DetailInputs inputs;
50 BuildI18nInputs(ADDRESS_TYPE_SHIPPING, "US", 0, &inputs);
51 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
52
53 const DetailInput& city = inputs[3];
54 ASSERT_EQ(ADDRESS_HOME_CITY, city.type);
55
56 const DetailInput& state = inputs[4];
57 ASSERT_EQ(ADDRESS_HOME_STATE, state.type);
58
59 const DetailInput& zip = inputs[5];
60 ASSERT_EQ(ADDRESS_HOME_ZIP, zip.type);
61
62 EXPECT_EQ(city.row_id, state.row_id);
63 EXPECT_EQ(state.row_id, zip.row_id);
64
65 // Inputs before or after [ City ] [ State ] [ Zip ] should be on other lines.
66 EXPECT_NE(inputs[2].row_id, city.row_id);
67 EXPECT_NE(inputs[6].row_id, city.row_id);
68 }
69
70 } // namespace i18ninput
71 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698