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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/test/address_metadata_test.cc

Issue 389863002: Remove Chrome's own version of libaddressinput in favor of the upstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (C) 2014 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include <libaddressinput/address_metadata.h>
16
17 #include <libaddressinput/address_field.h>
18
19 #include <gtest/gtest.h>
20
21 namespace {
22
23 using i18n::addressinput::COUNTRY;
24 using i18n::addressinput::ADMIN_AREA;
25 using i18n::addressinput::DEPENDENT_LOCALITY;
26
27 using i18n::addressinput::IsFieldRequired;
28 using i18n::addressinput::IsFieldUsed;
29
30 TEST(AddressMetadataTest, IsFieldRequiredCountry) {
31 EXPECT_TRUE(IsFieldRequired(COUNTRY, "US"));
32 EXPECT_TRUE(IsFieldRequired(COUNTRY, "CH"));
33 EXPECT_TRUE(IsFieldRequired(COUNTRY, "rrr"));
34 }
35
36 TEST(AddressMetadataTest, IsUsedRequiredCountry) {
37 EXPECT_TRUE(IsFieldUsed(COUNTRY, "US"));
38 EXPECT_TRUE(IsFieldUsed(COUNTRY, "CH"));
39 EXPECT_TRUE(IsFieldUsed(COUNTRY, "rrr"));
40 }
41
42 TEST(AddressMetadataTest, IsFieldRequiredAdminAreaUS) {
43 EXPECT_TRUE(IsFieldRequired(ADMIN_AREA, "US"));
44 }
45
46 TEST(AddressMetadataTest, IsFieldRequiredAdminAreaAT) {
47 EXPECT_FALSE(IsFieldRequired(ADMIN_AREA, "AT"));
48 }
49
50 TEST(AddressMetadataTest, IsFieldRequiredAdminAreaSU) {
51 // Unsupported region.
52 EXPECT_FALSE(IsFieldRequired(ADMIN_AREA, "SU"));
53 }
54
55 TEST(AddressMetadataTest, IsFieldUsedDependentLocalityUS) {
56 EXPECT_FALSE(IsFieldUsed(DEPENDENT_LOCALITY, "US"));
57 }
58
59 TEST(AddressMetadataTest, IsFieldUsedDependentLocalityCN) {
60 EXPECT_TRUE(IsFieldUsed(DEPENDENT_LOCALITY, "CN"));
61 }
62
63 TEST(AddressMetadataTest, IsFieldUsedDependentLocalitySU) {
64 // Unsupported region.
65 EXPECT_FALSE(IsFieldUsed(DEPENDENT_LOCALITY, "SU"));
66 }
67
68 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698