Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (C) 2014 Google Inc. | 1 // Copyright (C) 2014 Google Inc. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 | 549 |
| 550 for (size_t i = 0; i < kNumNoSuggestFields; ++i) { | 550 for (size_t i = 0; i < kNumNoSuggestFields; ++i) { |
| 551 std::vector<AddressData> suggestions; | 551 std::vector<AddressData> suggestions; |
| 552 EXPECT_EQ(AddressValidator::SUCCESS, | 552 EXPECT_EQ(AddressValidator::SUCCESS, |
| 553 validator_->GetSuggestions( | 553 validator_->GetSuggestions( |
| 554 address, kNoSugestFields[i], 999, &suggestions)); | 554 address, kNoSugestFields[i], 999, &suggestions)); |
| 555 EXPECT_TRUE(suggestions.empty()); | 555 EXPECT_TRUE(suggestions.empty()); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 TEST_F(AddressValidatorTest, CanonicalizeUsAdminAreaName) { | |
| 560 AddressData address; | |
| 561 address.country_code = "US"; | |
| 562 address.administrative_area = "California"; | |
| 563 EXPECT_TRUE(validator_->CanonicalizeAdministrativeArea(&address)); | |
| 564 EXPECT_EQ("CA", address.administrative_area); | |
| 565 } | |
| 566 | |
| 567 TEST_F(AddressValidatorTest, CanonicalizeUsAdminAreaKey) { | |
| 568 AddressData address; | |
| 569 address.country_code = "US"; | |
| 570 address.administrative_area = "CA"; | |
| 571 EXPECT_TRUE(validator_->CanonicalizeAdministrativeArea(&address)); | |
| 572 EXPECT_EQ("CA", address.administrative_area); | |
| 573 } | |
| 574 | |
| 575 TEST_F(AddressValidatorTest, CanonicalizeJpAdminAreaKey) { | |
| 576 validator_->LoadRules("JP"); | |
| 577 AddressData address; | |
| 578 address.country_code = "JP"; | |
| 579 address.administrative_area = "東京都"; | |
| 580 EXPECT_TRUE(validator_->CanonicalizeAdministrativeArea(&address)); | |
| 581 EXPECT_EQ("東京都", address.administrative_area); | |
| 582 } | |
| 583 | |
| 584 TEST_F(AddressValidatorTest, CanonicalizeJpAdminAreaLatinName) { | |
| 585 validator_->LoadRules("JP"); | |
| 586 AddressData address; | |
| 587 address.country_code = "JP"; | |
| 588 address.administrative_area = "Tokyo"; | |
|
Evan Stade
2014/04/16 01:40:29
I feel like we'd still want to normalize somewhat,
please use gerrit instead
2014/04/16 21:44:48
Done.
| |
| 589 EXPECT_TRUE(validator_->CanonicalizeAdministrativeArea(&address)); | |
| 590 EXPECT_EQ("Tokyo", address.administrative_area); | |
| 591 } | |
| 592 | |
| 559 } // namespace addressinput | 593 } // namespace addressinput |
| 560 } // namespace i18n | 594 } // namespace i18n |
| OLD | NEW |