diff options
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.cc | 7 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils_unittest.cc | 16 |
2 files changed, 20 insertions, 3 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index b682c2b..5d10ea8 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -185,9 +185,10 @@ bool DoesBookmarkContainWords(const BookmarkNode* node, return DoesBookmarkTextContainWords( l10n_util::ToLower(node->GetTitle()), words) || - DoesBookmarkTextContainWords(UTF8ToWide(node->GetURL().spec()), words) || - DoesBookmarkTextContainWords(net::FormatUrl( - node->GetURL(), languages, false, true, NULL, NULL, NULL), words); + DoesBookmarkTextContainWords( + l10n_util::ToLower(UTF8ToWide(node->GetURL().spec())), words) || + DoesBookmarkTextContainWords(l10n_util::ToLower(net::FormatUrl( + node->GetURL(), languages, false, true, NULL, NULL, NULL)), words); } } // namespace diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc index 620c79c..384a55e 100644 --- a/chrome/browser/bookmarks/bookmark_utils_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -77,6 +77,22 @@ TEST_F(BookmarkUtilsTest, DoesBookmarkContainText) { // Punycode query also matches as ever. ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( node, L"qcka1pmc", L"ja")); + + // Tests with various lower/upper case characters. + node = model.AddURL(model.other_node(), 0, L"FOO bar", + GURL("http://www.google.com/search?q=ABC")); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"foo", std::wstring())); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"Foo", std::wstring())); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"FOO", std::wstring())); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"google abc", std::wstring())); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"google ABC", std::wstring())); + ASSERT_TRUE(bookmark_utils::DoesBookmarkContainText( + node, L"http://www.google.com/search?q=A", std::wstring())); } #if !defined(OS_MACOSX) |