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

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

Issue 172082: Create new event_utils.h file for Cocoa-specific event to WindowOpenDispositi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/event_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_controller_unittest.mm (revision 23676)
+++ chrome/browser/cocoa/bookmark_bar_controller_unittest.mm (working copy)
@@ -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 @@
[[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:
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/event_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698