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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/profiles/profiles_state.h" | 12 #include "chrome/browser/profiles/profiles_state.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
15 #include "chrome/browser/ui/browser_window_state.h" | 15 #include "chrome/browser/ui/browser_window_state.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/common/profile_management_switches.h" | |
19 #include "chrome/test/base/browser_with_test_window_test.h" | 18 #include "chrome/test/base/browser_with_test_window_test.h" |
20 #include "chrome/test/base/test_browser_window.h" | 19 #include "chrome/test/base/test_browser_window.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
22 #include "chrome/test/base/testing_profile_manager.h" | 21 #include "chrome/test/base/testing_profile_manager.h" |
| 22 #include "components/signin/core/common/profile_management_switches.h" |
23 #include "content/public/browser/native_web_keyboard_event.h" | 23 #include "content/public/browser/native_web_keyboard_event.h" |
24 #include "ui/events/keycodes/keyboard_codes.h" | 24 #include "ui/events/keycodes/keyboard_codes.h" |
25 | 25 |
26 typedef BrowserWithTestWindowTest BrowserCommandControllerTest; | 26 typedef BrowserWithTestWindowTest BrowserCommandControllerTest; |
27 | 27 |
28 TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKey) { | 28 TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKey) { |
29 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
30 // F1-3 keys are reserved Chrome accelerators on Chrome OS. | 30 // F1-3 keys are reserved Chrome accelerators on Chrome OS. |
31 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | 31 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( |
32 IDC_BACK, content::NativeWebKeyboardEvent( | 32 IDC_BACK, content::NativeWebKeyboardEvent( |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 466 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
467 chrome::BrowserCommandController command_controller(browser(), | 467 chrome::BrowserCommandController command_controller(browser(), |
468 profile_manager); | 468 profile_manager); |
469 const CommandUpdater* command_updater = command_controller.command_updater(); | 469 const CommandUpdater* command_updater = command_controller.command_updater(); |
470 | 470 |
471 // Check that the SYNC_SETUP command is updated on preference change. | 471 // Check that the SYNC_SETUP command is updated on preference change. |
472 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 472 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
473 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 473 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
474 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 474 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
475 } | 475 } |
OLD | NEW |