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

Side by Side Diff: chrome/browser/autofill/phone_number_i18n_unittest.cc

Issue 6935033: Autofill DOMUI Prefs should work with i18n phone numbers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/autofill/phone_number_i18n.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 using namespace autofill_i18n;
10
11 TEST(PhoneNumberI18NTest, PhoneNumbersMatch) {
12 // Same numbers, defined country code.
13 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
14 ASCIIToUTF16("4158889999"),
15 "US"));
16 // Same numbers, undefined country code.
17 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
18 ASCIIToUTF16("4158889999"),
19 ""));
20
21 // Numbers differ by country code only.
22 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
23 ASCIIToUTF16("4158889999"),
24 "US"));
25
26 // Same numbers, different formats.
27 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
28 ASCIIToUTF16("415-888-9999"),
29 "US"));
30 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
31 ASCIIToUTF16("(415)888-9999"),
32 "US"));
33 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
34 ASCIIToUTF16("415 888 9999"),
35 "US"));
36 EXPECT_TRUE(PhoneNumbersMatch(ASCIIToUTF16("4158889999"),
37 ASCIIToUTF16("415 TUV WXYZ"),
38 "US"));
39
40 // Partial matches don't count.
41 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"),
42 ASCIIToUTF16("8889999"),
43 "US"));
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698