Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1112)

Side by Side Diff: chrome/browser/bookmarks/bookmark_utils_unittest.cc

Issue 50081: Free unit tests for Mac: BookmarkHTMLWriterTest, BookmarkUtilsTest, (Closed)
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/net/url_fetcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_model.h" 7 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/bookmarks/bookmark_utils.h" 8 #include "chrome/browser/bookmarks/bookmark_utils.h"
9 9
10 typedef testing::Test BookmarkUtilsTest; 10 typedef testing::Test BookmarkUtilsTest;
11 11
12 TEST_F(BookmarkUtilsTest, GetBookmarksContainingText) { 12 TEST_F(BookmarkUtilsTest, GetBookmarksContainingText) {
13 BookmarkModel model(NULL); 13 BookmarkModel model(NULL);
14 BookmarkNode* n1 = 14 BookmarkNode* n1 =
15 model.AddURL(model.other_node(), 0, L"foo bar", 15 model.AddURL(model.other_node(), 0, L"foo bar",
16 GURL("http://www.google.com")); 16 GURL("http://www.google.com"));
17 BookmarkNode* n2 = 17 BookmarkNode* n2 =
18 model.AddURL(model.other_node(), 0, L"baz buz", 18 model.AddURL(model.other_node(), 0, L"baz buz",
19 GURL("http://www.cnn.com")); 19 GURL("http://www.cnn.com"));
20 20
21 model.AddGroup(model.other_node(), 0, L"foo"); 21 model.AddGroup(model.other_node(), 0, L"foo");
22 22
23 std::vector<BookmarkNode*> nodes; 23 std::vector<BookmarkNode*> nodes;
24 bookmark_utils::GetBookmarksContainingText(&model, L"foo", 100, &nodes); 24 bookmark_utils::GetBookmarksContainingText(&model, L"foo", 100, &nodes);
25 ASSERT_EQ(1, nodes.size()); 25 ASSERT_EQ(static_cast<size_t>(1), nodes.size());
26 EXPECT_TRUE(nodes[0] == n1); 26 EXPECT_TRUE(nodes[0] == n1);
27 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo")); 27 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo"));
28 nodes.clear(); 28 nodes.clear();
29 29
30 bookmark_utils::GetBookmarksContainingText(&model, L"cnn", 100, &nodes); 30 bookmark_utils::GetBookmarksContainingText(&model, L"cnn", 100, &nodes);
31 ASSERT_EQ(1, nodes.size()); 31 ASSERT_EQ(static_cast<size_t>(1), nodes.size());
32 EXPECT_TRUE(nodes[0] == n2); 32 EXPECT_TRUE(nodes[0] == n2);
33 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n2, L"cnn")); 33 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n2, L"cnn"));
34 nodes.clear(); 34 nodes.clear();
35 35
36 bookmark_utils::GetBookmarksContainingText(&model, L"foo bar", 100, &nodes); 36 bookmark_utils::GetBookmarksContainingText(&model, L"foo bar", 100, &nodes);
37 ASSERT_EQ(1, nodes.size()); 37 ASSERT_EQ(static_cast<size_t>(1), nodes.size());
38 EXPECT_TRUE(nodes[0] == n1); 38 EXPECT_TRUE(nodes[0] == n1);
39 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo bar")); 39 EXPECT_TRUE(bookmark_utils::DoesBookmarkContainText(n1, L"foo bar"));
40 nodes.clear(); 40 nodes.clear();
41 } 41 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/url_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698