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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
index e5161690f03433c124b658f9edd79a9cc35de640..3f1a2eeeee576520a05a3ca95f5b6750327719de 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm
@@ -37,7 +37,7 @@ void DeleteBookmark(BookmarkButton* button, Profile* profile) {
const BookmarkNode* node = [button bookmarkNode];
if (node) {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
- model->Remove(node->parent(), node->parent()->GetIndexOf(node));
+ model->Remove(node);
}
}
@@ -192,8 +192,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest {
// Remove the bookmark with the long title.
void RemoveLongTitleNode() {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
- model->Remove(longTitleNode_->parent(),
- longTitleNode_->parent()->GetIndexOf(longTitleNode_));
+ model->Remove(longTitleNode_);
}
// Add LOTS of nodes to our model if needed (e.g. scrolling).
@@ -1322,7 +1321,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, MenuSizingAndScrollArrows) {
// We'll remove the really long node so we can see if the buttons get resized.
scrollerWidth = NSWidth([folderView frame]);
buttonWidth = NSWidth([button frame]);
- model->Remove(folder, reallyWideButtonNumber);
+ model->Remove(folder->GetChild(reallyWideButtonNumber));
EXPECT_FALSE([folderController canScrollUp]);
EXPECT_FALSE([folderController canScrollDown]);
@@ -1361,7 +1360,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, HoverThenDeleteBookmark) {
EXPECT_EQ(button, buttonThatMouseIsIn);
// Delete the bookmark and verify that it is now not known.
- model->Remove(folder, 3);
+ model->Remove(folder->GetChild(3));
buttonThatMouseIsIn = [bbfc buttonThatMouseIsIn];
EXPECT_FALSE(buttonThatMouseIsIn);
}

Powered by Google App Engine
This is Rietveld 408576698