| 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" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 TEST_F(BrowserCommandControllerTest, AppFullScreen) { | 132 TEST_F(BrowserCommandControllerTest, AppFullScreen) { |
| 133 // Enable for tabbed browser. | 133 // Enable for tabbed browser. |
| 134 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | 134 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 135 | 135 |
| 136 // Enabled for app windows. | 136 // Enabled for app windows. |
| 137 browser()->app_name_ = "app"; | 137 browser()->app_name_ = "app"; |
| 138 ASSERT_TRUE(browser()->is_app()); | 138 ASSERT_TRUE(browser()->is_app()); |
| 139 browser()->command_controller()->FullscreenStateChanged(); | 139 browser()->command_controller()->FullscreenStateChanged(); |
| 140 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | 140 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
| 141 | |
| 142 // Enabled for panels. | |
| 143 Browser::CreateParams panel_params(Browser::TYPE_PANEL, profile(), | |
| 144 browser()->host_desktop_type()); | |
| 145 TestBrowserWindow panel_window; | |
| 146 panel_params.window = &panel_window; | |
| 147 Browser panel_browser(panel_params); | |
| 148 ASSERT_TRUE(panel_browser.is_type_panel()); | |
| 149 EXPECT_TRUE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); | |
| 150 | |
| 151 // Disabled for app-panels. | |
| 152 panel_browser.app_name_ = "app"; | |
| 153 ASSERT_TRUE(panel_browser.is_app()); | |
| 154 panel_browser.command_controller()->FullscreenStateChanged(); | |
| 155 EXPECT_FALSE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); | |
| 156 } | 141 } |
| 157 | 142 |
| 158 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { | 143 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { |
| 159 if (!ProfileManager::IsMultipleProfilesEnabled()) | 144 if (!ProfileManager::IsMultipleProfilesEnabled()) |
| 160 return; | 145 return; |
| 161 | 146 |
| 162 TestingProfileManager testing_profile_manager( | 147 TestingProfileManager testing_profile_manager( |
| 163 TestingBrowserProcess::GetGlobal()); | 148 TestingBrowserProcess::GetGlobal()); |
| 164 ASSERT_TRUE(testing_profile_manager.SetUp()); | 149 ASSERT_TRUE(testing_profile_manager.SetUp()); |
| 165 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 150 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 330 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
| 346 chrome::BrowserCommandController command_controller(browser(), | 331 chrome::BrowserCommandController command_controller(browser(), |
| 347 profile_manager); | 332 profile_manager); |
| 348 const CommandUpdater* command_updater = command_controller.command_updater(); | 333 const CommandUpdater* command_updater = command_controller.command_updater(); |
| 349 | 334 |
| 350 // Check that the SYNC_SETUP command is updated on preference change. | 335 // Check that the SYNC_SETUP command is updated on preference change. |
| 351 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 336 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
| 352 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 337 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
| 353 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 338 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
| 354 } | 339 } |
| OLD | NEW |