OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | 5 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const std::string country_code = "US"; | 115 const std::string country_code = "US"; |
116 const std::string first_state = "AL"; | 116 const std::string first_state = "AL"; |
117 | 117 |
118 validator_->LoadRules(country_code); | 118 validator_->LoadRules(country_code); |
119 std::vector<std::string> sub_keys = | 119 std::vector<std::string> sub_keys = |
120 validator_->GetRegionSubKeys(country_code); | 120 validator_->GetRegionSubKeys(country_code); |
121 ASSERT_FALSE(sub_keys.empty()); | 121 ASSERT_FALSE(sub_keys.empty()); |
122 ASSERT_EQ(sub_keys[0], first_state); | 122 ASSERT_EQ(sub_keys[0], first_state); |
123 } | 123 } |
124 | 124 |
125 TEST_F(AddressValidatorTest, SubKeysNotLoaded) { | 125 TEST_F(AddressValidatorTest, SubKeysNotExists) { |
126 const std::string country_code = "ZZ"; | 126 const std::string country_code = "OZ"; |
127 | 127 |
128 validator_->LoadRules(country_code); | 128 validator_->LoadRules(country_code); |
129 std::vector<std::string> sub_keys = | 129 std::vector<std::string> sub_keys = |
130 validator_->GetRegionSubKeys(country_code); | 130 validator_->GetRegionSubKeys(country_code); |
131 ASSERT_TRUE(sub_keys.empty()); | 131 ASSERT_TRUE(sub_keys.empty()); |
132 } | 132 } |
133 | 133 |
134 TEST_F(AddressValidatorTest, RegionHasRules) { | 134 TEST_F(AddressValidatorTest, RegionHasRules) { |
135 const std::vector<std::string>& region_codes = GetRegionCodes(); | 135 const std::vector<std::string>& region_codes = GetRegionCodes(); |
136 AddressData address; | 136 AddressData address; |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 source_->set_failures_number(99); | 910 source_->set_failures_number(99); |
911 validator_->LoadRules("CH"); | 911 validator_->LoadRules("CH"); |
912 validator_->LoadRules("GB"); | 912 validator_->LoadRules("GB"); |
913 base::RunLoop().RunUntilIdle(); | 913 base::RunLoop().RunUntilIdle(); |
914 | 914 |
915 EXPECT_FALSE(load_rules_success_); | 915 EXPECT_FALSE(load_rules_success_); |
916 EXPECT_EQ(16, source_->attempts_number()); | 916 EXPECT_EQ(16, source_->attempts_number()); |
917 } | 917 } |
918 | 918 |
919 } // namespace autofill | 919 } // namespace autofill |
OLD | NEW |