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/string16.h" | 5 #include "base/string16.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/autofill_profile.h" | 7 #include "components/autofill/browser/autofill_profile.h" |
8 #include "chrome/browser/autofill/field_types.h" | 8 #include "components/autofill/browser/field_types.h" |
9 #include "chrome/browser/autofill/phone_number.h" | 9 #include "components/autofill/browser/phone_number.h" |
10 #include "chrome/browser/autofill/phone_number_i18n.h" | 10 #include "components/autofill/browser/phone_number_i18n.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 TEST(PhoneNumberTest, Matcher) { | 13 TEST(PhoneNumberTest, Matcher) { |
14 AutofillProfile profile; | 14 AutofillProfile profile; |
15 profile.SetCountryCode("US"); | 15 profile.SetCountryCode("US"); |
16 // Set phone number so country_code == 1, city_code = 650, number = 2345678. | 16 // Set phone number so country_code == 1, city_code = 650, number = 2345678. |
17 string16 phone(ASCIIToUTF16("1 [650] 234-5678")); | 17 string16 phone(ASCIIToUTF16("1 [650] 234-5678")); |
18 PhoneNumber phone_number(&profile); | 18 PhoneNumber phone_number(&profile); |
19 phone_number.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone, "US"); | 19 phone_number.SetInfo(PHONE_HOME_WHOLE_NUMBER, phone, "US"); |
20 | 20 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 PhoneNumber::PhoneCombineHelper number7; | 194 PhoneNumber::PhoneCombineHelper number7; |
195 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_CITY_CODE, | 195 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_CITY_CODE, |
196 ASCIIToUTF16("650"))); | 196 ASCIIToUTF16("650"))); |
197 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, | 197 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, |
198 ASCIIToUTF16("234"))); | 198 ASCIIToUTF16("234"))); |
199 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, | 199 EXPECT_TRUE(number7.SetInfo(PHONE_HOME_NUMBER, |
200 ASCIIToUTF16("5682"))); | 200 ASCIIToUTF16("5682"))); |
201 EXPECT_TRUE(number7.ParseNumber(AutofillProfile(), "en-US", &parsed_phone)); | 201 EXPECT_TRUE(number7.ParseNumber(AutofillProfile(), "en-US", &parsed_phone)); |
202 EXPECT_EQ(ASCIIToUTF16("(650) 234-5682"), parsed_phone); | 202 EXPECT_EQ(ASCIIToUTF16("(650) 234-5682"), parsed_phone); |
203 } | 203 } |
OLD | NEW |