| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "components/autofill/browser/autofill_profile.h" | 7 #include "components/autofill/core/browser/autofill_profile.h" |
| 8 #include "components/autofill/browser/field_types.h" | 8 #include "components/autofill/core/browser/field_types.h" |
| 9 #include "components/autofill/browser/phone_number.h" | 9 #include "components/autofill/core/browser/phone_number.h" |
| 10 #include "components/autofill/browser/phone_number_i18n.h" | 10 #include "components/autofill/core/browser/phone_number_i18n.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace autofill { | 13 namespace autofill { |
| 14 | 14 |
| 15 TEST(PhoneNumberTest, Matcher) { | 15 TEST(PhoneNumberTest, Matcher) { |
| 16 AutofillProfile profile; | 16 AutofillProfile profile; |
| 17 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); | 17 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); |
| 18 // Set phone number so country_code == 1, city_code = 650, number = 2345678. | 18 // Set phone number so country_code == 1, city_code = 650, number = 2345678. |
| 19 base::string16 phone(ASCIIToUTF16("1 [650] 234-5678")); | 19 base::string16 phone(ASCIIToUTF16("1 [650] 234-5678")); |
| 20 PhoneNumber phone_number(&profile); | 20 PhoneNumber phone_number(&profile); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ASCIIToUTF16("650"))); | 198 ASCIIToUTF16("650"))); |
| 199 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, | 199 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, |
| 200 ASCIIToUTF16("234"))); | 200 ASCIIToUTF16("234"))); |
| 201 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, | 201 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, |
| 202 ASCIIToUTF16("5682"))); | 202 ASCIIToUTF16("5682"))); |
| 203 EXPECT_TRUE(number7.ParseNumber(AutofillProfile(), "en-US", &parsed_phone)); | 203 EXPECT_TRUE(number7.ParseNumber(AutofillProfile(), "en-US", &parsed_phone)); |
| 204 EXPECT_EQ(ASCIIToUTF16("(650) 234-5682"), parsed_phone); | 204 EXPECT_EQ(ASCIIToUTF16("(650) 234-5682"), parsed_phone); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace autofill | 207 } // namespace autofill |
| OLD | NEW |