Index: base/i18n/string_search_unittest.cc |
diff --git a/base/i18n/string_search_unittest.cc b/base/i18n/string_search_unittest.cc |
index b24600e1d4a1a2f54061428b5bc50de65930d95b..d2bd53a6d130a0441fc9f2e7de587c80b646926b 100644 |
--- a/base/i18n/string_search_unittest.cc |
+++ b/base/i18n/string_search_unittest.cc |
@@ -199,5 +199,28 @@ TEST(StringSearchTest, UnicodeLocaleDependent) { |
SetICUDefaultLocale(default_locale); |
} |
+TEST(StringSearchTest, FixedPatternMultipleSearch) { |
+ std::string default_locale(uloc_getDefault()); |
+ bool locale_is_posix = (default_locale == "en_US_POSIX"); |
+ if (locale_is_posix) |
+ SetICUDefaultLocale("en_US"); |
+ |
+ size_t index = 0; |
+ size_t length = 0; |
+ |
+ // Search "hello" over multiple texts. |
+ FixedPatternStringSearchIgnoringCaseAndAccents query(ASCIIToUTF16("hello")); |
+ EXPECT_TRUE(query.Search(ASCIIToUTF16("12hello34"), &index, &length)); |
+ EXPECT_EQ(2U, index); |
+ EXPECT_EQ(5U, length); |
+ EXPECT_FALSE(query.Search(ASCIIToUTF16("bye"), &index, &length)); |
+ EXPECT_TRUE(query.Search(ASCIIToUTF16("hELLo"), &index, &length)); |
+ EXPECT_EQ(0U, index); |
+ EXPECT_EQ(5U, length); |
+ |
+ if (locale_is_posix) |
+ SetICUDefaultLocale(default_locale.data()); |
+} |
+ |
} // namespace i18n |
} // namespace base |