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

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

Issue 344008: Implemented most of HtmlDialogWindowController, which is a Cocoa port (Closed)
Patch Set: Added TODOs. Created 11 years, 2 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/cocoa/chrome_event_processing_window_unittest.mm
diff --git a/chrome/browser/cocoa/chrome_event_processing_window_unittest.mm b/chrome/browser/cocoa/chrome_event_processing_window_unittest.mm
index 48c8d236d21a0a0d552e99ea45a4fa77f38ce3c0..05b99f51b52a872c05dc8b4b978ee177cd5560b5 100644
--- a/chrome/browser/cocoa/chrome_event_processing_window_unittest.mm
+++ b/chrome/browser/cocoa/chrome_event_processing_window_unittest.mm
@@ -66,6 +66,19 @@ class ChromeEventProcessingWindowTest : public CocoaTest {
ChromeEventProcessingWindow* window_;
};
+id CreateBrowserWindowControllerMock() {
+ id delegate = [OCMockObject mockForClass:[BrowserWindowController class]];
+ // Make conformsToProtocol return YES for @protocol(BrowserCommandExecutor)
+ // to satisfy the DCHECK() in handleExtraKeyboardShortcut.
+ //
+ // TODO(akalin): Figure out how to replace OCMOCK_ANY below with
+ // @protocol(BrowserCommandExecutor) and have it work.
+ BOOL yes = YES;
+ [[[delegate stub] andReturnValue:OCMOCK_VALUE(yes)]
+ conformsToProtocol:OCMOCK_ANY];
+ return delegate;
+}
+
// Verify that the window intercepts a particular key event and
// forwards it to [delegate executeCommand:]. Assume that other
// CommandForKeyboardShortcut() will work the same for the rest.
@@ -73,11 +86,7 @@ TEST_F(ChromeEventProcessingWindowTest,
PerformKeyEquivalentForwardToExecuteCommand) {
NSEvent* event = KeyEvent(NSCommandKeyMask, kVK_ANSI_1);
- id delegate = [OCMockObject mockForClass:[BrowserWindowController class]];
- // -stub to satisfy the DCHECK.
- BOOL yes = YES;
- [[[delegate stub] andReturnValue:OCMOCK_VALUE(yes)]
- isKindOfClass:[BrowserWindowController class]];
+ id delegate = CreateBrowserWindowControllerMock();
[[delegate expect] executeCommand:IDC_SELECT_TAB_0];
[window_ setDelegate:delegate];
@@ -95,11 +104,7 @@ TEST_F(ChromeEventProcessingWindowTest,
TEST_F(ChromeEventProcessingWindowTest, PerformKeyEquivalentNoForward) {
NSEvent* event = KeyEvent(0, 0);
- id delegate = [OCMockObject mockForClass:[BrowserWindowController class]];
- // -stub to satisfy the DCHECK.
- BOOL yes = YES;
- [[[delegate stub] andReturnValue:OCMOCK_VALUE(yes)]
- isKindOfClass:[BrowserWindowController class]];
+ id delegate = CreateBrowserWindowControllerMock();
[window_ setDelegate:delegate];
[window_ performKeyEquivalent:event];
« no previous file with comments | « chrome/browser/cocoa/chrome_event_processing_window.mm ('k') | chrome/browser/cocoa/html_dialog_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698