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

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

Issue 1931043002: Remove requestAutocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
6
7 #include <stddef.h>
8
9 #include "components/autofill/core/browser/field_types.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui .h"
12
13 namespace autofill {
14 namespace i18ninput {
15
16 namespace {
17
18 const size_t kNumberOfAddressLinesUS = 6;
19
20 } // namespace
21
22 TEST(AutofillDialogI18nInput, USShippingAddress) {
23 DetailInputs inputs;
24 std::string language_code;
25 BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "US", &inputs,
26 &language_code);
27
28 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
29 EXPECT_EQ(NAME_FULL, inputs[0].type);
30 EXPECT_EQ(ADDRESS_HOME_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
31 EXPECT_EQ("en", language_code);
32 }
33
34 TEST(AutofillDialogI18nInput, USBillingAddress) {
35 DetailInputs inputs;
36 BuildAddressInputs(common::ADDRESS_TYPE_BILLING, "US", &inputs, NULL);
37
38 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
39 EXPECT_EQ(NAME_BILLING_FULL, inputs[0].type);
40 EXPECT_EQ(ADDRESS_BILLING_COUNTRY, inputs[kNumberOfAddressLinesUS - 1].type);
41 }
42
43 TEST(AutofillDialogI18nInput, USCityStateAndZipCodeShareInputRow) {
44 DetailInputs inputs;
45 BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "US", &inputs, NULL);
46 ASSERT_EQ(kNumberOfAddressLinesUS, inputs.size());
47
48 int input_index = 2;
49
50 // Inputs before or after [ City ] [ State ] [ Zip ] should be on other lines.
51 EXPECT_NE(inputs[input_index - 1].length, DetailInput::SHORT);
52
53 const DetailInput& city = inputs[input_index++];
54 EXPECT_EQ(ADDRESS_HOME_CITY, city.type);
55 EXPECT_EQ(city.length, DetailInput::SHORT);
56
57 const DetailInput& state = inputs[input_index++];
58 EXPECT_EQ(ADDRESS_HOME_STATE, state.type);
59 EXPECT_EQ(state.length, DetailInput::SHORT);
60
61 const DetailInput& zip = inputs[input_index++];
62 EXPECT_EQ(ADDRESS_HOME_ZIP, zip.type);
63 EXPECT_EQ(zip.length, DetailInput::SHORT);
64
65 EXPECT_NE(inputs[input_index].length, DetailInput::SHORT);
66 }
67
68 TEST(AutofillDialogI18nInput, IvoryCoastNoStreetLine2) {
69 DetailInputs inputs;
70 std::string language_code;
71 BuildAddressInputs(common::ADDRESS_TYPE_SHIPPING, "CI", &inputs,
72 &language_code);
73 for (size_t i = 0; i < inputs.size(); ++i) {
74 EXPECT_NE(ADDRESS_HOME_LINE2, inputs[i].type);
75 }
76 EXPECT_EQ("fr", language_code);
77 }
78
79 } // namespace i18ninput
80 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_i18n_input.cc ('k') | chrome/browser/ui/autofill/autofill_dialog_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698