blob: 4daf6a22ff12ff08ecb032b3e728a53155ff132b [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h"
#include "base/mac/scoped_nsobject.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
// Tests that UIApplication correctly calls the keyboard command action block
// when invoked.
TEST(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) {
__block BOOL called = NO;
UIKeyCommand* command =
[UIKeyCommand cr_keyCommandWithInput:@""
modifierFlags:Cr_UIKeyModifierNone
title:nil
action:^{
called = YES;
}];
[[UIApplication sharedApplication] cr_handleKeyCommand:command];
EXPECT_TRUE(called);
}
} // namespace