summaryrefslogtreecommitdiffstats
path: root/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
diff options
context:
space:
mode:
authordeepak.m1 <deepak.m1@samsung.com>2015-05-04 09:29:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-04 16:30:16 +0000
commit39312670405cf55ce9b4790817e11f3492ae3c05 (patch)
treef036729d1879ee89020bda94f3a0e3791f90f925 /components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
parent5cccb9c1a6caafde10b5e74f93d0f925074039ea (diff)
downloadchromium_src-39312670405cf55ce9b4790817e11f3492ae3c05.zip
chromium_src-39312670405cf55ce9b4790817e11f3492ae3c05.tar.gz
chromium_src-39312670405cf55ce9b4790817e11f3492ae3c05.tar.bz2
Avoid unnacessarily conversion from index to BookmarkNode pointer.
BookmarkModel::Remove() should take BookmarkNode pointer. This will few save conversion from BookmarkNode pointer to index for calling Remove and converting index to BookmarkNode pointer to call RemoveAndDeleteNode(). This way we will able to save call's like parent->GetIndexOf(node),and again conversion to Bookmark Pointer. BUG=330842 Review URL: https://codereview.chromium.org/1105413002 Cr-Commit-Position: refs/heads/master@{#328135}
Diffstat (limited to 'components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc')
-rw-r--r--components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
index 4b53abd..c7c29f9 100644
--- a/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
+++ b/components/enhanced_bookmarks/enhanced_bookmark_model_unittest.cc
@@ -595,12 +595,11 @@ TEST_F(EnhancedBookmarkModelTest, ObserverNodeRemovedEvent) {
const BookmarkNode* folder = AddFolder();
EXPECT_EQ(0, removed_calls_);
- bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node));
+ bookmark_model_->Remove(node);
EXPECT_EQ(1, removed_calls_);
EXPECT_EQ(node, last_removed_);
- bookmark_model_->Remove(folder->parent(),
- folder->parent()->GetIndexOf(folder));
+ bookmark_model_->Remove(folder);
EXPECT_EQ(2, removed_calls_);
EXPECT_EQ(folder, last_removed_);
}
@@ -675,7 +674,7 @@ TEST_F(EnhancedBookmarkModelTest, NodeRemovedWhileResetDuplicationScheduled) {
const BookmarkNode* node2 = AddBookmark();
bookmark_model_->SetNodeMetaInfo(node1, "stars.id", "c_1");
bookmark_model_->SetNodeMetaInfo(node2, "stars.id", "c_1");
- bookmark_model_->Remove(node1->parent(), node1->parent()->GetIndexOf(node1));
+ bookmark_model_->Remove(node1);
base::RunLoop().RunUntilIdle();
}
@@ -686,8 +685,7 @@ TEST_F(EnhancedBookmarkModelTest,
std::string remote_id = GetId(node);
EXPECT_EQ(node, model_->BookmarkForRemoteId(remote_id));
- const BookmarkNode* gp = parent->parent();
- bookmark_model_->Remove(gp, gp->GetIndexOf(parent));
+ bookmark_model_->Remove(parent);
EXPECT_FALSE(model_->BookmarkForRemoteId(remote_id));
}