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

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

Issue 2893323002: [Mac] Force invalidate bookmark bar layout on node change (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fb429c296b6a3de5f6ea0d72ca526a4356a3eae0..c6294e9255a44457de461e209677f10e3945ab1e 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -720,6 +720,24 @@ TEST_F(BookmarkBarControllerTest, LayoutManagedAppsButton) {
EXPECT_TRUE(layout.IsAppsButtonVisible());
}
+// This tests a formerly-pathological case where if there was a single
+// bookmark on the bar and it was renamed, the button wouldn't update
+// since the offset and number of buttons stayed the same.
+// See crbug.com/724201
+TEST_F(BookmarkBarControllerTest, RenameBookmark) {
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
+ const BookmarkNode* barNode = model->bookmark_bar_node();
+ const BookmarkNode* node = model->AddURL(barNode, 0, ASCIIToUTF16("Lorem"),
+ GURL("http://example.com"));
+ EXPECT_EQ([[bar_ buttons] count], 1U);
+ EXPECT_NSEQ([[[bar_ buttons] firstObject] title], @"Lorem");
+
+ model->SetTitle(node, ASCIIToUTF16("Ipsum"));
+ [bar_ rebuildLayoutWithAnimated:NO];
+ EXPECT_EQ([[bar_ buttons] count], 1U);
+ EXPECT_NSEQ([[[bar_ buttons] firstObject] title], @"Ipsum");
+}
+
TEST_F(BookmarkBarControllerTest, NoItemsResizing) {
bookmarks::BookmarkBarLayout layout = [bar_ layoutFromCurrentState];
EXPECT_TRUE(layout.IsNoItemTextFieldVisible() &&
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698