| 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/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/command_updater.h" | 9 #include "chrome/browser/command_updater.h" |
| 10 #include "chrome/browser/profiles/profile_destroyer.h" | 10 #include "chrome/browser/profiles/profile_destroyer.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/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
| 14 #include "chrome/browser/ui/browser_window_state.h" | 15 #include "chrome/browser/ui/browser_window_state.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/browser_with_test_window_test.h" | 17 #include "chrome/test/base/browser_with_test_window_test.h" |
| 17 #include "chrome/test/base/test_browser_window.h" | 18 #include "chrome/test/base/test_browser_window.h" |
| 18 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
| 19 #include "chrome/test/base/testing_profile_manager.h" | 20 #include "chrome/test/base/testing_profile_manager.h" |
| 20 #include "content/public/browser/native_web_keyboard_event.h" | 21 #include "content/public/browser/native_web_keyboard_event.h" |
| 21 #include "ui/base/keycodes/keyboard_codes.h" | 22 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | 135 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 135 | 136 |
| 136 // Enabled for app windows. | 137 // Enabled for app windows. |
| 137 browser()->app_name_ = "app"; | 138 browser()->app_name_ = "app"; |
| 138 ASSERT_TRUE(browser()->is_app()); | 139 ASSERT_TRUE(browser()->is_app()); |
| 139 browser()->command_controller()->FullscreenStateChanged(); | 140 browser()->command_controller()->FullscreenStateChanged(); |
| 140 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | 141 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 141 } | 142 } |
| 142 | 143 |
| 143 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { | 144 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { |
| 144 if (!ProfileManager::IsMultipleProfilesEnabled()) | 145 if (!profiles::IsMultipleProfilesEnabled()) |
| 145 return; | 146 return; |
| 146 | 147 |
| 147 TestingProfileManager testing_profile_manager( | 148 TestingProfileManager testing_profile_manager( |
| 148 TestingBrowserProcess::GetGlobal()); | 149 TestingBrowserProcess::GetGlobal()); |
| 149 ASSERT_TRUE(testing_profile_manager.SetUp()); | 150 ASSERT_TRUE(testing_profile_manager.SetUp()); |
| 150 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 151 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
| 151 | 152 |
| 152 chrome::BrowserCommandController command_controller(browser(), | 153 chrome::BrowserCommandController command_controller(browser(), |
| 153 profile_manager); | 154 profile_manager); |
| 154 const CommandUpdater* command_updater = command_controller.command_updater(); | 155 const CommandUpdater* command_updater = command_controller.command_updater(); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 328 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
| 328 chrome::BrowserCommandController command_controller(browser(), | 329 chrome::BrowserCommandController command_controller(browser(), |
| 329 profile_manager); | 330 profile_manager); |
| 330 const CommandUpdater* command_updater = command_controller.command_updater(); | 331 const CommandUpdater* command_updater = command_controller.command_updater(); |
| 331 | 332 |
| 332 // Check that the SYNC_SETUP command is updated on preference change. | 333 // Check that the SYNC_SETUP command is updated on preference change. |
| 333 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 334 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
| 334 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 335 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
| 335 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 336 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
| 336 } | 337 } |
| OLD | NEW |