OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" | 8 #import "chrome/browser/ui/cocoa/accelerators_cocoa.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "testing/gtest_mac.h" |
10 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 11 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
11 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 12 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
12 #include "testing/gtest_mac.h" | |
13 | 13 |
14 typedef InProcessBrowserTest AcceleratorsCocoaBrowserTest; | 14 typedef InProcessBrowserTest AcceleratorsCocoaBrowserTest; |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Adds all NSMenuItems with an accelerator to the array. | 18 // Adds all NSMenuItems with an accelerator to the array. |
19 void AddAcceleratorItemsToArray(NSMenu* menu, NSMutableArray* array) { | 19 void AddAcceleratorItemsToArray(NSMenu* menu, NSMutableArray* array) { |
20 for (NSMenuItem* item in [menu itemArray]) { | 20 for (NSMenuItem* item in [menu itemArray]) { |
21 NSMenu* submenu = item.submenu; | 21 NSMenu* submenu = item.submenu; |
22 if (submenu) | 22 if (submenu) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 MenuContainsAccelerator([NSApp mainMenu], | 124 MenuContainsAccelerator([NSApp mainMenu], |
125 platform_accelerator->characters(), | 125 platform_accelerator->characters(), |
126 platform_accelerator->modifier_mask()); | 126 platform_accelerator->modifier_mask()); |
127 EXPECT_TRUE(item); | 127 EXPECT_TRUE(item); |
128 | 128 |
129 // If the menu uses a commandDispatch:, the tag must match the command id! | 129 // If the menu uses a commandDispatch:, the tag must match the command id! |
130 if (item.action == @selector(commandDispatch:)) | 130 if (item.action == @selector(commandDispatch:)) |
131 EXPECT_EQ(item.tag, it->first); | 131 EXPECT_EQ(item.tag, it->first); |
132 } | 132 } |
133 } | 133 } |
OLD | NEW |