Chromium Code Reviews| Index: third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| diff --git a/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc b/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| index 13b5a8b4cc32ac547bdc2ef42cc3b7bb7b602a33..a7717401cbfafb65a5c1127e1cd390cfa3e21e3f 100644 |
| --- a/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| +++ b/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| @@ -5,6 +5,7 @@ |
| #include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
| #include <stddef.h> |
| +#include <set> |
| #include <string> |
| #include <utility> |
| #include <vector> |
| @@ -67,14 +68,21 @@ class AddressValidatorTest : public testing::Test, LoadRulesListener { |
| private: |
| // LoadRulesListener implementation. |
| - virtual void OnAddressValidationRulesLoaded(const std::string& country_code, |
| - bool success) override { |
| + void OnAddressRulesLoaded(const std::string& country_code, |
| + bool success) override { |
| AddressData address_data; |
| address_data.region_code = country_code; |
| FieldProblemMap dummy; |
| AddressValidator::Status status = |
| validator_->ValidateAddress(address_data, NULL, &dummy); |
| ASSERT_EQ(success, status == AddressValidator::SUCCESS); |
| + |
| + if (!country_code.compare("US")) { |
|
sebsg
2017/03/21 15:29:52
This should be in it's own test case instead of in
Parastoo
2017/03/21 20:05:52
Done.
|
| + std::vector<std::string> sub_keys = |
| + validator_->GetRegionSubKeys("US"); |
| + ASSERT_FALSE(sub_keys.empty()); |
| + ASSERT_EQ(sub_keys[0], "AL"); |
| + } |
| } |
| DISALLOW_COPY_AND_ASSIGN(AddressValidatorTest); |
| @@ -758,7 +766,7 @@ class FailingAddressValidatorTest : public testing::Test, LoadRulesListener { |
| virtual ~TestAddressValidator() {} |
| protected: |
| - virtual base::TimeDelta GetBaseRetryPeriod() const override { |
| + base::TimeDelta GetBaseRetryPeriod() const override { |
| return base::TimeDelta::FromSeconds(0); |
| } |
| @@ -770,7 +778,7 @@ class FailingAddressValidatorTest : public testing::Test, LoadRulesListener { |
| // data. |
| class FailingSource : public Source { |
| public: |
| - explicit FailingSource() |
| + FailingSource() |
| : failures_number_(0), attempts_number_(0), actual_source_(true) {} |
| virtual ~FailingSource() {} |
| @@ -781,8 +789,7 @@ class FailingAddressValidatorTest : public testing::Test, LoadRulesListener { |
| // Source implementation. |
| // Always fails for the first |failures_number| times. |
| - virtual void Get(const std::string& url, |
| - const Callback& callback) const override { |
| + void Get(const std::string& url, const Callback& callback) const override { |
| ++attempts_number_; |
| // |callback| takes ownership of the |new std::string|. |
| if (failures_number_-- > 0) |
| @@ -823,8 +830,7 @@ class FailingAddressValidatorTest : public testing::Test, LoadRulesListener { |
| private: |
| // LoadRulesListener implementation. |
| - virtual void OnAddressValidationRulesLoaded(const std::string&, |
| - bool success) override { |
| + void OnAddressRulesLoaded(const std::string&, bool success) override { |
| load_rules_success_ = success; |
| } |