| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #import "chrome/browser/ui/cocoa/clickhold_button_cell.h" | 6 #import "chrome/browser/ui/cocoa/clickhold_button_cell.h" |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 8 #import "chrome/browser/ui/cocoa/menu_button.h" | 8 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 9 | 9 |
| 10 @interface MenuButtonTestDelegate : NSObject<NSMenuDelegate> { | 10 @interface MenuButtonTestDelegate : NSObject<NSMenuDelegate> { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // Command to open the menu should not be available. | 240 // Command to open the menu should not be available. |
| 241 NSArray* actionNames = [buttonCell accessibilityActionNames]; | 241 NSArray* actionNames = [buttonCell accessibilityActionNames]; |
| 242 EXPECT_FALSE([actionNames containsObject:NSAccessibilityShowMenuAction]); | 242 EXPECT_FALSE([actionNames containsObject:NSAccessibilityShowMenuAction]); |
| 243 | 243 |
| 244 [button_ setOpenMenuOnRightClick:YES]; | 244 [button_ setOpenMenuOnRightClick:YES]; |
| 245 | 245 |
| 246 // Command to open the menu should now become available. | 246 // Command to open the menu should now become available. |
| 247 actionNames = [buttonCell accessibilityActionNames]; | 247 actionNames = [buttonCell accessibilityActionNames]; |
| 248 EXPECT_TRUE([actionNames containsObject:NSAccessibilityShowMenuAction]); | 248 EXPECT_TRUE([actionNames containsObject:NSAccessibilityShowMenuAction]); |
| 249 | 249 |
| 250 [button_ setOpenMenuOnClick:NO]; |
| 251 |
| 252 // Command should still be available, even when both click + hold and right |
| 253 // click are turned on. |
| 254 actionNames = [buttonCell accessibilityActionNames]; |
| 255 EXPECT_TRUE([actionNames containsObject:NSAccessibilityShowMenuAction]); |
| 256 |
| 250 [buttonCell accessibilityPerformAction:NSAccessibilityShowMenuAction]; | 257 [buttonCell accessibilityPerformAction:NSAccessibilityShowMenuAction]; |
| 251 EXPECT_TRUE([delegate didOpen]); | 258 EXPECT_TRUE([delegate didOpen]); |
| 252 EXPECT_FALSE([delegate isOpen]); | 259 EXPECT_FALSE([delegate isOpen]); |
| 253 } | 260 } |
| 254 | 261 |
| 255 } // namespace | 262 } // namespace |
| OLD | NEW |