Roll src/third_party/WebKit 8139f33:52503da (svn 201975:201976)
[chromium-blink-merge.git] / third_party / libaddressinput / chromium / addressinput_util_unittest.cc
blobb68ea81760d7d5ddf75f9b82f0a8f6c7aa9537fc
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.
5 #include "third_party/libaddressinput/chromium/addressinput_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
10 namespace autofill {
11 namespace addressinput {
13 using ::i18n::addressinput::AddressData;
15 TEST(AddressinputUtilTest, AddressRequiresRegionCode) {
16 AddressData address;
17 EXPECT_FALSE(HasAllRequiredFields(address));
20 TEST(AddressinputUtilTest, UsRequiresState) {
21 AddressData address;
22 address.region_code = "US";
23 address.postal_code = "90291";
24 // Leave state empty.
25 address.locality = "Los Angeles";
26 address.address_line.push_back("340 Main St.");
27 EXPECT_FALSE(HasAllRequiredFields(address));
30 TEST(AddressinputUtilTest, CompleteAddressReturnsTrue) {
31 AddressData address;
32 address.region_code = "US";
33 address.postal_code = "90291";
34 address.administrative_area = "CA";
35 address.locality = "Los Angeles";
36 address.address_line.push_back("340 Main St.");
37 EXPECT_TRUE(HasAllRequiredFields(address));
40 } // namespace addressinput
41 } // namespace autofill