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

Unified Diff: third_party/libaddressinput/chromium/has_all_required_fields_unittest.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Specify the string size in canonicalizer. Created 6 years, 6 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
Index: third_party/libaddressinput/chromium/has_all_required_fields_unittest.cc
diff --git a/third_party/libaddressinput/chromium/has_all_required_fields_unittest.cc b/third_party/libaddressinput/chromium/has_all_required_fields_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a13702e79b28e41085183663f9798e369bedd2eb
--- /dev/null
+++ b/third_party/libaddressinput/chromium/has_all_required_fields_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2014 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.
+
+#include "third_party/libaddressinput/chromium/has_all_required_fields.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
+
+namespace autofill {
+namespace addressinput {
+
+using ::i18n::addressinput::AddressData;
+
+TEST(HasAllRequiredFields, AddressRequiresRegionCode) {
+ AddressData address;
+ EXPECT_FALSE(HasAllRequiredFields(address));
+}
+
+TEST(HasAllRequiredFields, UsRequiresState) {
+ AddressData address;
+ address.region_code = "US";
+ address.postal_code = "90291";
+ // Leave state empty.
+ address.locality = "Los Angeles";
+ address.address_line.push_back("340 Main St.");
+ EXPECT_FALSE(HasAllRequiredFields(address));
+}
+
+TEST(HasAllRequiredFields, CompleteAddressReturnsTrue) {
+ AddressData address;
+ address.region_code = "US";
+ address.postal_code = "90291";
+ address.administrative_area = "CA";
+ address.locality = "Los Angeles";
+ address.address_line.push_back("340 Main St.");
+ EXPECT_TRUE(HasAllRequiredFields(address));
+}
+
+} // namespace addressinput
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698