| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h" | 5 #import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 10 namespace { | 14 namespace { |
| 11 | 15 |
| 12 // Tests that UIApplication correctly calls the keyboard command action block | 16 // Tests that UIApplication correctly calls the keyboard command action block |
| 13 // when invoked. | 17 // when invoked. |
| 14 TEST(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) { | 18 TEST(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) { |
| 15 __block BOOL called = NO; | 19 __block BOOL called = NO; |
| 16 UIKeyCommand* command = | 20 UIKeyCommand* command = |
| 17 [UIKeyCommand cr_keyCommandWithInput:@"" | 21 [UIKeyCommand cr_keyCommandWithInput:@"" |
| 18 modifierFlags:Cr_UIKeyModifierNone | 22 modifierFlags:Cr_UIKeyModifierNone |
| 19 title:nil | 23 title:nil |
| 20 action:^{ | 24 action:^{ |
| 21 called = YES; | 25 called = YES; |
| 22 }]; | 26 }]; |
| 23 [[UIApplication sharedApplication] cr_handleKeyCommand:command]; | 27 [[UIApplication sharedApplication] cr_handleKeyCommand:command]; |
| 24 EXPECT_TRUE(called); | 28 EXPECT_TRUE(called); |
| 25 } | 29 } |
| 26 | 30 |
| 27 } // namespace | 31 } // namespace |
| OLD | NEW |