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.h" | 5 #include "chrome/browser/ui/browser.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_command_controller.h" | 8 #include "chrome/browser/ui/browser_command_controller.h" |
9 #include "chrome/browser/ui/browser_window_state.h" | 9 #include "chrome/browser/ui/browser_window_state.h" |
10 #include "chrome/test/base/browser_with_test_window_test.h" | 10 #include "chrome/test/base/browser_with_test_window_test.h" |
11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
12 | 12 |
13 // Various assertions around setting show state. | |
14 TEST_F(BrowserWithTestWindowTest, GetSavedWindowShowState) { | |
15 // Default show state is SHOW_STATE_DEFAULT. | |
16 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, chrome::GetSavedWindowShowState(browser())); | |
17 | |
18 // Explicitly specifying a state should stick though. | |
19 browser()->set_initial_show_state(ui::SHOW_STATE_MAXIMIZED); | |
20 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, | |
21 chrome::GetSavedWindowShowState(browser())); | |
22 browser()->set_initial_show_state(ui::SHOW_STATE_NORMAL); | |
23 EXPECT_EQ(ui::SHOW_STATE_NORMAL, chrome::GetSavedWindowShowState(browser())); | |
24 browser()->set_initial_show_state(ui::SHOW_STATE_MINIMIZED); | |
25 EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, | |
26 chrome::GetSavedWindowShowState(browser())); | |
27 browser()->set_initial_show_state(ui::SHOW_STATE_FULLSCREEN); | |
28 EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN, | |
29 chrome::GetSavedWindowShowState(browser())); | |
30 } | |
31 | |
32 TEST_F(BrowserWithTestWindowTest, IsReservedCommandOrKey) { | 13 TEST_F(BrowserWithTestWindowTest, IsReservedCommandOrKey) { |
33 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
34 const content::NativeWebKeyboardEvent event(ui::ET_KEY_PRESSED, | 15 const content::NativeWebKeyboardEvent event(ui::ET_KEY_PRESSED, |
35 false, | 16 false, |
36 ui::VKEY_F1, | 17 ui::VKEY_F1, |
37 0, | 18 0, |
38 base::Time::Now().ToDoubleT()); | 19 base::Time::Now().ToDoubleT()); |
39 // F1-4 keys are reserved on Chrome OS. | 20 // F1-4 keys are reserved on Chrome OS. |
40 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(IDC_BACK, | 21 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(IDC_BACK, |
41 event)); | 22 event)); |
42 // ..unless |command_id| is -1. crbug.com/122978 | 23 // ..unless |command_id| is -1. crbug.com/122978 |
43 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(-1, | 24 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(-1, |
44 event)); | 25 event)); |
45 #endif | 26 #endif |
46 } | 27 } |
OLD | NEW |