Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 BookmarkModel model(NULL); | 31 BookmarkModel model(NULL); |
| 32 const BookmarkNode* n1 = model.AddURL(model.other_node(), | 32 const BookmarkNode* n1 = model.AddURL(model.other_node(), |
| 33 0, | 33 0, |
| 34 ASCIIToUTF16("foo bar"), | 34 ASCIIToUTF16("foo bar"), |
| 35 GURL("http://www.google.com")); | 35 GURL("http://www.google.com")); |
| 36 const BookmarkNode* n2 = model.AddURL(model.other_node(), | 36 const BookmarkNode* n2 = model.AddURL(model.other_node(), |
| 37 0, | 37 0, |
| 38 ASCIIToUTF16("baz buz"), | 38 ASCIIToUTF16("baz buz"), |
| 39 GURL("http://www.cnn.com")); | 39 GURL("http://www.cnn.com")); |
| 40 | 40 |
| 41 model.AddFolder(model.other_node(), 0, ASCIIToUTF16("foo")); | 41 const BookmarkNode* n3 = model.AddFolder(model.other_node(), |
|
tfarina
2013/11/21 23:00:16
I'd name this folder1, or even just folder.
| |
| 42 0, | |
| 43 ASCIIToUTF16("foo")); | |
| 42 | 44 |
| 43 std::vector<const BookmarkNode*> nodes; | 45 std::vector<const BookmarkNode*> nodes; |
| 44 GetBookmarksContainingText( | 46 GetBookmarksContainingText( |
| 45 &model, ASCIIToUTF16("foo"), 100, string(), &nodes); | 47 &model, ASCIIToUTF16("foo"), 100, string(), &nodes); |
| 46 ASSERT_EQ(1U, nodes.size()); | 48 ASSERT_EQ(2U, nodes.size()); |
| 47 EXPECT_TRUE(nodes[0] == n1); | 49 EXPECT_TRUE(nodes[0] == n3); |
| 50 EXPECT_TRUE(nodes[1] == n1); | |
| 48 nodes.clear(); | 51 nodes.clear(); |
| 49 | 52 |
| 50 GetBookmarksContainingText( | 53 GetBookmarksContainingText( |
| 51 &model, ASCIIToUTF16("cnn"), 100, string(), &nodes); | 54 &model, ASCIIToUTF16("cnn"), 100, string(), &nodes); |
| 52 ASSERT_EQ(1U, nodes.size()); | 55 ASSERT_EQ(1U, nodes.size()); |
| 53 EXPECT_TRUE(nodes[0] == n2); | 56 EXPECT_TRUE(nodes[0] == n2); |
| 54 nodes.clear(); | 57 nodes.clear(); |
| 55 | 58 |
| 56 GetBookmarksContainingText( | 59 GetBookmarksContainingText( |
| 57 &model, ASCIIToUTF16("foo bar"), 100, string(), &nodes); | 60 &model, ASCIIToUTF16("foo bar"), 100, string(), &nodes); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 | 124 |
| 122 // This tests the case where selection doesn't contain any items. | 125 // This tests the case where selection doesn't contain any items. |
| 123 nodes.clear(); | 126 nodes.clear(); |
| 124 real_parent = GetParentForNewNodes(model.bookmark_bar_node(), nodes, &index); | 127 real_parent = GetParentForNewNodes(model.bookmark_bar_node(), nodes, &index); |
| 125 EXPECT_EQ(real_parent, model.bookmark_bar_node()); | 128 EXPECT_EQ(real_parent, model.bookmark_bar_node()); |
| 126 EXPECT_EQ(2, index); | 129 EXPECT_EQ(2, index); |
| 127 } | 130 } |
| 128 | 131 |
| 129 } // namespace | 132 } // namespace |
| 130 } // namespace bookmark_utils | 133 } // namespace bookmark_utils |
| OLD | NEW |