summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser_unittest.cc
blob: 683ed678783e7c9cc4d4b0207ed4e5218b0d958e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2012 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.

#include "chrome/browser/ui/browser.h"

#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_window_state.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "content/public/browser/native_web_keyboard_event.h"

TEST_F(BrowserWithTestWindowTest, IsReservedCommandOrKey) {
#if defined(OS_CHROMEOS)
  const content::NativeWebKeyboardEvent event(ui::ET_KEY_PRESSED,
                                              false,
                                              ui::VKEY_F1,
                                              0,
                                              base::Time::Now().ToDoubleT());
  // F1-4 keys are reserved on Chrome OS.
  EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(IDC_BACK,
                                                                      event));
  // ..unless |command_id| is -1. crbug.com/122978
  EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(-1,
                                                                       event));
#endif
}