Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / chrome / browser / ui / keyboard / UIKeyCommand+ChromeTest.mm
blob4daf6a22ff12ff08ecb032b3e728a53155ff132b
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
3 // found in the LICENSE file.
5 #import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h"
7 #include "base/mac/scoped_nsobject.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace {
12 // Tests that UIApplication correctly calls the keyboard command action block
13 // when invoked.
14 TEST(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) {
15   __block BOOL called = NO;
16   UIKeyCommand* command =
17       [UIKeyCommand cr_keyCommandWithInput:@""
18                              modifierFlags:Cr_UIKeyModifierNone
19                                      title:nil
20                                     action:^{
21                                       called = YES;
22                                     }];
23   [[UIApplication sharedApplication] cr_handleKeyCommand:command];
24   EXPECT_TRUE(called);
27 }  // namespace