diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 03:18:25 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 03:18:25 +0000 |
commit | 1f31bb798cc0c1b1f4a848bbea961ae977510307 (patch) | |
tree | 013388440d7337b82ce6029e0783826b77246f98 /chrome/browser/bookmarks | |
parent | ab8c60a4db86e2e95dcbcfef94a1363bf5d7eaeb (diff) | |
download | chromium_src-1f31bb798cc0c1b1f4a848bbea961ae977510307.zip chromium_src-1f31bb798cc0c1b1f4a848bbea961ae977510307.tar.gz chromium_src-1f31bb798cc0c1b1f4a848bbea961ae977510307.tar.bz2 |
Make bookmarks manager search work for URLs containing uppercase characters
BUG=30427
TEST=BookmarkUtilsTest.DoesBookmarkContainText
TEST=Add a bookmark item for a URL containing upper case, open the bookmarks manager and type in the URL in the 'Search' form. Make sure the bookmark is found.
Review URL: http://codereview.chromium.org/502011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-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) |