diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 17:22:32 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 17:22:32 +0000 |
commit | cb362ccc87064ae0ee4459ee089e00972b4a76e7 (patch) | |
tree | 46af771471ea7700d18dfbfa173e544e14c83998 /chrome/browser/bookmarks/bookmark_utils_unittest.cc | |
parent | f5b43627c9d7faeca9475c38ec67960c1fca46af (diff) | |
download | chromium_src-cb362ccc87064ae0ee4459ee089e00972b4a76e7.zip chromium_src-cb362ccc87064ae0ee4459ee089e00972b4a76e7.tar.gz chromium_src-cb362ccc87064ae0ee4459ee089e00972b4a76e7.tar.bz2 |
Changes bookmark manager search to use contains vs starts with and to
search urls.
BUG=4065
TEST=create the URL foo.com and type 'foo.com' in the bookmark manager
search box. Make sure the url you just typed shows up in the table.
Review URL: http://codereview.chromium.org/13679
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_utils_unittest.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils_unittest.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc new file mode 100644 index 0000000..bbd49cc --- /dev/null +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "testing/gtest/include/gtest/gtest.h" + +#include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/bookmarks/bookmark_utils.h" + +typedef testing::Test BookmarkUtilsTest; + +TEST_F(BookmarkUtilsTest, GetBookmarksContainingText) { + BookmarkModel model(NULL); + BookmarkNode* n1 = + model.AddURL(model.other_node(), 0, L"foo bar", + GURL("http://www.google.com")); + BookmarkNode* n2 = + model.AddURL(model.other_node(), 0, L"baz buz", + GURL("http://www.cnn.com")); + + model.AddGroup(model.other_node(), 0, L"foo"); + + std::vector<BookmarkNode*> nodes; + bookmark_utils::GetBookmarksContainingText(&model, L"foo", 100, &nodes); + ASSERT_EQ(1, nodes.size()); + EXPECT_TRUE(nodes[0] == n1); + EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo")); + nodes.clear(); + + bookmark_utils::GetBookmarksContainingText(&model, L"cnn", 100, &nodes); + ASSERT_EQ(1, nodes.size()); + EXPECT_TRUE(nodes[0] == n2); + EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n2, L"cnn")); + nodes.clear(); + + bookmark_utils::GetBookmarksContainingText(&model, L"foo bar", 100, &nodes); + ASSERT_EQ(1, nodes.size()); + EXPECT_TRUE(nodes[0] == n1); + EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo bar")); + nodes.clear(); +} |