diff options
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller_unittest.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 161f12a..d72caa3 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -9,6 +9,7 @@ #import "chrome/browser/cocoa/bookmark_bar_controller.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" +#include "chrome/browser/cocoa/test_event_utils.h" #import "chrome/browser/cocoa/view_resizer_pong.h" #include "testing/gtest/include/gtest/gtest.h" @@ -503,6 +504,25 @@ TEST_F(BookmarkBarControllerTest, Display) { [[bar_ view] display]; } +// Test that middle clicking on a bookmark button results in an open action. +TEST_F(BookmarkBarControllerTest, MiddleClick) { + BookmarkModel* model = helper_.profile()->GetBookmarkModel(); + GURL gurl1("http://www.google.com/"); + std::wstring title1(L"x"); + model->SetURLStarred(gurl1, title1, true); + + EXPECT_EQ(1U, [[bar_ buttons] count]); + NSButton* first = [[bar_ buttons] objectAtIndex:0]; + EXPECT_TRUE(first); + + scoped_nsobject<BookmarkURLOpenerPong> pong([[BookmarkURLOpenerPong alloc] + init]); + [bar_ setUrlDelegate:pong.get()]; + [first otherMouseUp:test_event_utils::MakeMouseEvent(NSOtherMouseUp, 0)]; + EXPECT_EQ(pong.get()->urls_.size(), 1U); + [bar_ setUrlDelegate:nil]; +} + // Cannot test these methods since they simply call a single static // method, BookmarkEditor::Show(), which is impossible to mock. // editBookmark:, addPage: |