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

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

Issue 583223002: Open just folder menu on middle clicking chevron button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes addressing comments. Created 6 years, 3 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 bac815687de944e72914cb7b97665d9d6839c042..a56c10c650c00061727e19ae770465ec94803c0d 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -939,7 +939,8 @@ TEST_F(BookmarkBarControllerTest, Display) {
[[bar_ view] display];
}
-// Test that middle clicking on a bookmark button results in an open action.
+// Test that middle clicking on a bookmark button results in an open action,
+// except for offTheSideButton, as it just opens its folder menu.
TEST_F(BookmarkBarControllerTest, MiddleClick) {
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
GURL gurl1("http://www.google.com/");
@@ -953,6 +954,37 @@ TEST_F(BookmarkBarControllerTest, MiddleClick) {
[first otherMouseUp:
cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0)];
EXPECT_EQ(noOpenBar()->urls_.size(), 1U);
+
+ // Test for offTheSideButton.
+ // Add more bookmarks so that offTheSideButton is visible.
+ const BookmarkNode* parent = model->bookmark_bar_node();
+ for (int i = 0; i < 20; i++) {
+ model->AddURL(parent, parent->child_count(),
+ ASCIIToUTF16("super duper wide title"),
+ GURL("http://superfriends.hall-of-justice.edu"));
+ }
+ EXPECT_FALSE([bar_ offTheSideButtonIsHidden]);
+
+ NSButton* offTheSideButton = [bar_ offTheSideButton];
+ EXPECT_TRUE(offTheSideButton);
+ [offTheSideButton otherMouseUp:
+ cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0)];
+
+ // Middle click on offTheSideButton should not open any bookmarks under it,
+ // therefore urls size should still be 1.
+ EXPECT_EQ(noOpenBar()->urls_.size(), 1U);
+
+ // Check that folderController should not be NULL since offTheSideButton
+ // folder is currently open.
+ BookmarkBarFolderController* bbfc = [bar_ folderController];
+ EXPECT_TRUE(bbfc);
+ EXPECT_TRUE([bbfc parentButton] == offTheSideButton);
+
+ // Middle clicking again on it should close the folder.
+ [offTheSideButton otherMouseUp:
+ cocoa_test_event_utils::MouseEventWithType(NSOtherMouseUp, 0)];
+ bbfc = [bar_ folderController];
+ EXPECT_FALSE(bbfc);
}
TEST_F(BookmarkBarControllerTest, DisplaysHelpMessageOnEmpty) {
« 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