diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 22:29:20 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 22:29:20 +0000 |
commit | b3c33d463366d2725ec4d669b98dc468a751c541 (patch) | |
tree | d8496a8ae8fc73ed71b93d67c055e9f1bba4fcc7 /chrome/browser/bookmarks/bookmark_drag_data_unittest.cc | |
parent | 7b91dfd0bce7b4f864d9654e8bd0a9f93683cec0 (diff) | |
download | chromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.zip chromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.tar.gz chromium_src-b3c33d463366d2725ec4d669b98dc468a751c541.tar.bz2 |
Make bookmark model public interface use const BookmarkNode* instead of
BookmarkNode*. This helps in making the BookmarkNode class setters public
also without worrying about someone inadvertently changing BookmarkNode
properties directly for bookmark model bookmarks.
Change all the call sites to reflect this.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/146116
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_drag_data_unittest.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data_unittest.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc index 9507196..02b2016 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc @@ -51,10 +51,10 @@ TEST_F(BookmarkDragDataTest, URL) { profile.CreateBookmarkModel(false); profile.SetID(L"id"); BookmarkModel* model = profile.GetBookmarkModel(); - BookmarkNode* root = model->GetBookmarkBarNode(); + const BookmarkNode* root = model->GetBookmarkBarNode(); GURL url(GURL("http://foo.com")); const std::wstring title(L"blah"); - BookmarkNode* node = model->AddURL(root, 0, title, url); + const BookmarkNode* node = model->AddURL(root, 0, title, url); BookmarkDragData drag_data(node); EXPECT_TRUE(drag_data.is_valid()); ASSERT_EQ(1, drag_data.elements.size()); @@ -93,10 +93,10 @@ TEST_F(BookmarkDragDataTest, Group) { profile.CreateBookmarkModel(false); profile.SetID(L"id"); BookmarkModel* model = profile.GetBookmarkModel(); - BookmarkNode* root = model->GetBookmarkBarNode(); - BookmarkNode* g1 = model->AddGroup(root, 0, L"g1"); - BookmarkNode* g11 = model->AddGroup(g1, 0, L"g11"); - BookmarkNode* g12 = model->AddGroup(g1, 0, L"g12"); + const BookmarkNode* root = model->GetBookmarkBarNode(); + const BookmarkNode* g1 = model->AddGroup(root, 0, L"g1"); + const BookmarkNode* g11 = model->AddGroup(g1, 0, L"g11"); + const BookmarkNode* g12 = model->AddGroup(g1, 0, L"g12"); BookmarkDragData drag_data(g12); EXPECT_TRUE(drag_data.is_valid()); @@ -117,7 +117,7 @@ TEST_F(BookmarkDragDataTest, Group) { EXPECT_FALSE(read_data.elements[0].is_url); // We should get back the same node when asking for the same profile. - BookmarkNode* r_g12 = read_data.GetFirstNode(&profile); + const BookmarkNode* r_g12 = read_data.GetFirstNode(&profile); EXPECT_TRUE(g12 == r_g12); // A different profile should return NULL for the node. @@ -131,8 +131,8 @@ TEST_F(BookmarkDragDataTest, GroupWithChild) { profile.SetID(L"id"); profile.CreateBookmarkModel(false); BookmarkModel* model = profile.GetBookmarkModel(); - BookmarkNode* root = model->GetBookmarkBarNode(); - BookmarkNode* group = model->AddGroup(root, 0, L"g1"); + const BookmarkNode* root = model->GetBookmarkBarNode(); + const BookmarkNode* group = model->AddGroup(root, 0, L"g1"); GURL url(GURL("http://foo.com")); const std::wstring title(L"blah2"); @@ -159,7 +159,7 @@ TEST_F(BookmarkDragDataTest, GroupWithChild) { EXPECT_TRUE(read_child.is_url); // And make sure we get the node back. - BookmarkNode* r_group = read_data.GetFirstNode(&profile); + const BookmarkNode* r_group = read_data.GetFirstNode(&profile); EXPECT_TRUE(group == r_group); } @@ -169,16 +169,16 @@ TEST_F(BookmarkDragDataTest, MultipleNodes) { profile.SetID(L"id"); profile.CreateBookmarkModel(false); BookmarkModel* model = profile.GetBookmarkModel(); - BookmarkNode* root = model->GetBookmarkBarNode(); - BookmarkNode* group = model->AddGroup(root, 0, L"g1"); + const BookmarkNode* root = model->GetBookmarkBarNode(); + const BookmarkNode* group = model->AddGroup(root, 0, L"g1"); GURL url(GURL("http://foo.com")); const std::wstring title(L"blah2"); - BookmarkNode* url_node = model->AddURL(group, 0, title, url); + const BookmarkNode* url_node = model->AddURL(group, 0, title, url); // Write the nodes to the clipboard. - std::vector<BookmarkNode*> nodes; + std::vector<const BookmarkNode*> nodes; nodes.push_back(group); nodes.push_back(url_node); BookmarkDragData drag_data(nodes); @@ -204,7 +204,7 @@ TEST_F(BookmarkDragDataTest, MultipleNodes) { EXPECT_EQ(0, read_url.children.size()); // And make sure we get the node back. - std::vector<BookmarkNode*> read_nodes = read_data.GetNodes(&profile); + std::vector<const BookmarkNode*> read_nodes = read_data.GetNodes(&profile); ASSERT_EQ(2, read_nodes.size()); EXPECT_TRUE(read_nodes[0] == group); EXPECT_TRUE(read_nodes[1] == url_node); |