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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/phone_number_i18n.h" | 7 #include "chrome/browser/autofill/phone_number_i18n.h" |
8 #include "content/test/test_browser_thread.h" | 8 #include "content/test/test_browser_thread.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 using autofill_i18n::NormalizePhoneNumber; | 11 using autofill_i18n::NormalizePhoneNumber; |
12 using autofill_i18n::ParsePhoneNumber; | 12 using autofill_i18n::ParsePhoneNumber; |
13 using autofill_i18n::ConstructPhoneNumber; | 13 using autofill_i18n::ConstructPhoneNumber; |
14 using autofill_i18n::PhoneNumbersMatch; | 14 using autofill_i18n::PhoneNumbersMatch; |
| 15 using content::BrowserThread; |
15 | 16 |
16 class PhoneNumberI18NTest : public testing::Test { | 17 class PhoneNumberI18NTest : public testing::Test { |
17 public: | 18 public: |
18 // In order to access the application locale -- which the tested functions do | 19 // In order to access the application locale -- which the tested functions do |
19 // internally -- this test must run on the UI thread. | 20 // internally -- this test must run on the UI thread. |
20 PhoneNumberI18NTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} | 21 PhoneNumberI18NTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} |
21 | 22 |
22 private: | 23 private: |
23 MessageLoopForUI message_loop_; | 24 MessageLoopForUI message_loop_; |
24 content::TestBrowserThread ui_thread_; | 25 content::TestBrowserThread ui_thread_; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // Partial matches don't count. | 370 // Partial matches don't count. |
370 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), | 371 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), |
371 ASCIIToUTF16("8889999"), | 372 ASCIIToUTF16("8889999"), |
372 "US")); | 373 "US")); |
373 | 374 |
374 // Different numbers don't match. | 375 // Different numbers don't match. |
375 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), | 376 EXPECT_FALSE(PhoneNumbersMatch(ASCIIToUTF16("14158889999"), |
376 ASCIIToUTF16("1415888"), | 377 ASCIIToUTF16("1415888"), |
377 "US")); | 378 "US")); |
378 } | 379 } |
OLD | NEW |