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

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

Issue 2950353002: [Payments] Avoid a crash caused by AddressValidatorTest. (Closed)
Patch Set: Remove a comment. Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698