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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_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_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
index 727df0bf1ab6ded2ff4cd132745957423e771aa8..fae50e5ad2b86debf7dec8913a50a26ec021256d 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -529,7 +529,7 @@ TEST_F(BookmarkBarControllerTest, NoItemContainerGoesAway) {
ASCIIToUTF16("title"),
GURL("http://www.google.com"));
EXPECT_TRUE([noItemContainer isHidden]);
- model->Remove(bar, bar->GetIndexOf(node));
+ model->Remove(node);
EXPECT_FALSE([noItemContainer isHidden]);
// Now try it using a bookmark from the Other Bookmarks.
@@ -582,7 +582,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideButtonHidden) {
if ([bar_ offTheSideButtonIsHidden])
break;
// Delete the last button.
- model->Remove(parent, parent->child_count() - 1);
+ model->Remove(parent->GetChild(parent->child_count() - 1));
// If last one make sure the menu is closed and the button is hidden.
// Else make sure menu stays open.
if ([bar_ offTheSideButtonIsHidden]) {
@@ -633,7 +633,7 @@ TEST_F(BookmarkBarControllerTest, DeleteFromOffTheSideWhileItIsOpen) {
}
// Then we remove the node. This triggers the button to get
// deleted.
- model->Remove(parent, indices[i]);
+ model->Remove(parent->GetChild(indices[i]));
// Force visual update which is otherwise delayed.
[[bbfc window] displayIfNeeded];
}
@@ -803,7 +803,7 @@ TEST_F(BookmarkBarControllerTest, TestButtonLimits) {
// Add 30 which we expect to be 'too many'. Make sure we don't see
// 30 buttons.
- model->Remove(parent, 0);
+ model->Remove(parent->GetChild(0));
EXPECT_EQ(0U, [[bar_ buttons] count]);
for (int i=0; i<30; i++) {
model->AddURL(parent, parent->child_count(),
@@ -892,8 +892,7 @@ TEST_F(BookmarkBarControllerTest, DeleteBookmark) {
}
EXPECT_EQ(3, parent->child_count());
const BookmarkNode* middle_node = parent->GetChild(1);
- model->Remove(middle_node->parent(),
- middle_node->parent()->GetIndexOf(middle_node));
+ model->Remove(middle_node);
EXPECT_EQ(2, parent->child_count());
EXPECT_EQ(parent->GetChild(0)->url(), GURL(urls[0]));
@@ -1372,7 +1371,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideFolder) {
// Delete a bookmark in the off-the-side and verify it's gone.
BookmarkButton* button = [bbfc buttonWithTitleEqualTo:@"DELETE_ME"];
EXPECT_TRUE(button);
- model->Remove(parent, parent->child_count() - 2);
+ model->Remove(parent->GetChild(parent->child_count() - 2));
button = [bbfc buttonWithTitleEqualTo:@"DELETE_ME"];
EXPECT_FALSE(button);
}

Powered by Google App Engine
This is Rietveld 408576698