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 "chrome/browser/ui/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/browser_window_state.h" | 10 #include "chrome/browser/ui/browser_window_state.h" |
10 #include "chrome/test/base/browser_with_test_window_test.h" | 11 #include "chrome/test/base/browser_with_test_window_test.h" |
11 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
12 #include "ui/base/keycodes/keyboard_codes.h" | 13 #include "ui/base/keycodes/keyboard_codes.h" |
13 | 14 |
14 TEST_F(BrowserWithTestWindowTest, IsReservedCommandOrKey) { | 15 TEST_F(BrowserWithTestWindowTest, IsReservedCommandOrKey) { |
15 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
16 // F1-3 keys are reserved Chrome accelerators on Chrome OS. | 17 // F1-3 keys are reserved Chrome accelerators on Chrome OS. |
17 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | 18 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( |
18 IDC_BACK, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED, false, | 19 IDC_BACK, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED, false, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 IDC_NEW_WINDOW, content::NativeWebKeyboardEvent( | 111 IDC_NEW_WINDOW, content::NativeWebKeyboardEvent( |
111 ui::ET_KEY_PRESSED, false, ui::VKEY_N, ui::EF_CONTROL_DOWN, 0))); | 112 ui::ET_KEY_PRESSED, false, ui::VKEY_N, ui::EF_CONTROL_DOWN, 0))); |
112 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey( | 113 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey( |
113 IDC_CLOSE_TAB, content::NativeWebKeyboardEvent( | 114 IDC_CLOSE_TAB, content::NativeWebKeyboardEvent( |
114 ui::ET_KEY_PRESSED, false, ui::VKEY_W, ui::EF_CONTROL_DOWN, 0))); | 115 ui::ET_KEY_PRESSED, false, ui::VKEY_W, ui::EF_CONTROL_DOWN, 0))); |
115 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey( | 116 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey( |
116 IDC_FIND, content::NativeWebKeyboardEvent( | 117 IDC_FIND, content::NativeWebKeyboardEvent( |
117 ui::ET_KEY_PRESSED, false, ui::VKEY_F, ui::EF_CONTROL_DOWN, 0))); | 118 ui::ET_KEY_PRESSED, false, ui::VKEY_F, ui::EF_CONTROL_DOWN, 0))); |
118 #endif // USE_AURA | 119 #endif // USE_AURA |
119 } | 120 } |
| 121 |
| 122 TEST_F(BrowserWithTestWindowTest, AppFullScreen) { |
| 123 // Enable for tabbed browser. |
| 124 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 125 |
| 126 // Enabled for app windows. |
| 127 browser()->app_name_ = "app"; |
| 128 ASSERT_TRUE(browser()->is_app()); |
| 129 browser()->command_controller()->FullscreenStateChanged(); |
| 130 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 131 |
| 132 // Enabled for panels. |
| 133 Browser::CreateParams panel_params(Browser::TYPE_PANEL, profile()); |
| 134 TestBrowserWindow panel_window; |
| 135 panel_params.window = &panel_window; |
| 136 Browser panel_browser(panel_params); |
| 137 ASSERT_TRUE(panel_browser.is_type_panel()); |
| 138 EXPECT_TRUE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); |
| 139 |
| 140 // Disabled for app-panels. |
| 141 panel_browser.app_name_ = "app"; |
| 142 ASSERT_TRUE(panel_browser.is_app()); |
| 143 panel_browser.command_controller()->FullscreenStateChanged(); |
| 144 EXPECT_FALSE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); |
| 145 } |
OLD | NEW |