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 bc4c9d8ac138a6fe82f1653ceabd3155bb34cfd6..80033a27abad1cbea42613828e64c00cc2c2f10a 100644 |
| --- a/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| +++ b/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc |
| @@ -62,6 +62,10 @@ class AddressValidatorTest : public testing::Test, LoadRulesListener { |
| validator_->LoadRules("US"); |
| } |
| + void set_expected_status(AddressValidator::Status expected_status) { |
| + expected_status_ = expected_status; |
| + } |
| + |
| virtual ~AddressValidatorTest() {} |
| const std::unique_ptr<AddressValidator> validator_; |
| @@ -75,9 +79,11 @@ class AddressValidatorTest : public testing::Test, LoadRulesListener { |
| FieldProblemMap dummy; |
| AddressValidator::Status status = |
| validator_->ValidateAddress(address_data, NULL, &dummy); |
| - ASSERT_EQ(success, status == AddressValidator::SUCCESS); |
| + ASSERT_EQ(success, status == expected_status_); |
|
Mathieu
2017/06/29 19:11:25
I think the expected value usually comes first in
Parastoo
2017/06/29 21:13:24
Done.
|
| } |
| + AddressValidator::Status expected_status_ = AddressValidator::SUCCESS; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AddressValidatorTest); |
| }; |
| @@ -122,8 +128,10 @@ TEST_F(AddressValidatorTest, SubKeysLoaded) { |
| ASSERT_EQ(sub_keys[0], first_state); |
| } |
| -TEST_F(AddressValidatorTest, SubKeysNotLoaded) { |
| - const std::string country_code = "ZZ"; |
| +TEST_F(AddressValidatorTest, SubKeysNotExists) { |
|
Mathieu
2017/06/29 19:11:25
How about SubKeys_NonExistent
Parastoo
2017/06/29 21:13:24
Done.
|
| + const std::string country_code = "OZ"; |
| + |
| + set_expected_status(AddressValidator::RULES_UNAVAILABLE); |
| validator_->LoadRules(country_code); |
| std::vector<std::string> sub_keys = |