OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/android/phone_number_detector.h" | 5 #include "content/renderer/android/phone_number_detector.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
9 | 11 |
10 namespace content { | 12 namespace content { |
11 | 13 |
12 class PhoneNumberDetectorTest : public testing::Test { | 14 class PhoneNumberDetectorTest : public testing::Test { |
13 public: | 15 public: |
14 static std::string FindNumber(const std::string& content, | 16 static std::string FindNumber(const std::string& content, |
15 const std::string& region) { | 17 const std::string& region) { |
16 base::string16 content_16 = base::UTF8ToUTF16(content); | 18 base::string16 content_16 = base::UTF8ToUTF16(content); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 EXPECT_EQ("+18002378289", FindAndFormatNumber("1-800-BEST BUY", "us")); | 82 EXPECT_EQ("+18002378289", FindAndFormatNumber("1-800-BEST BUY", "us")); |
81 // TODO(qinmin): support alpha number detection when there are characters on | 83 // TODO(qinmin): support alpha number detection when there are characters on |
82 // either side of the string. | 84 // either side of the string. |
83 EXPECT_EQ("", FindAndFormatNumber("hello 1-800-BEST-BUY", "us")); | 85 EXPECT_EQ("", FindAndFormatNumber("hello 1-800-BEST-BUY", "us")); |
84 EXPECT_EQ("", FindAndFormatNumber("BestBuy", "us")); | 86 EXPECT_EQ("", FindAndFormatNumber("BestBuy", "us")); |
85 EXPECT_EQ("", FindAndFormatNumber("1-BestBuy", "us")); | 87 EXPECT_EQ("", FindAndFormatNumber("1-BestBuy", "us")); |
86 EXPECT_EQ("", FindAndFormatNumber("1 BestBuy", "us")); | 88 EXPECT_EQ("", FindAndFormatNumber("1 BestBuy", "us")); |
87 } | 89 } |
88 | 90 |
89 } // namespace content | 91 } // namespace content |
OLD | NEW |