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/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 ASSERT_TRUE(panel_browser.is_app()); | 148 ASSERT_TRUE(panel_browser.is_app()); |
149 panel_browser.command_controller()->FullscreenStateChanged(); | 149 panel_browser.command_controller()->FullscreenStateChanged(); |
150 EXPECT_FALSE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); | 150 EXPECT_FALSE(chrome::IsCommandEnabled(&panel_browser, IDC_FULLSCREEN)); |
151 } | 151 } |
152 | 152 |
153 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { | 153 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { |
154 if (!ProfileManager::IsMultipleProfilesEnabled()) | 154 if (!ProfileManager::IsMultipleProfilesEnabled()) |
155 return; | 155 return; |
156 | 156 |
157 TestingProfileManager testing_profile_manager( | 157 TestingProfileManager testing_profile_manager( |
158 static_cast<TestingBrowserProcess*>(g_browser_process)); | 158 TestingBrowserProcess::GetGlobal()); |
159 ASSERT_TRUE(testing_profile_manager.SetUp()); | 159 ASSERT_TRUE(testing_profile_manager.SetUp()); |
160 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 160 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
161 | 161 |
162 chrome::BrowserCommandController command_controller(browser(), | 162 chrome::BrowserCommandController command_controller(browser(), |
163 profile_manager); | 163 profile_manager); |
164 const CommandUpdater* command_updater = command_controller.command_updater(); | 164 const CommandUpdater* command_updater = command_controller.command_updater(); |
165 | 165 |
166 testing_profile_manager.CreateTestingProfile("p1"); | 166 testing_profile_manager.CreateTestingProfile("p1"); |
167 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); | 167 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); |
168 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); | 168 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); |
169 | 169 |
170 testing_profile_manager.CreateTestingProfile("p2"); | 170 testing_profile_manager.CreateTestingProfile("p2"); |
171 ASSERT_EQ(2U, profile_manager->GetNumberOfProfiles()); | 171 ASSERT_EQ(2U, profile_manager->GetNumberOfProfiles()); |
172 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); | 172 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); |
173 | 173 |
174 testing_profile_manager.DeleteTestingProfile("p1"); | 174 testing_profile_manager.DeleteTestingProfile("p1"); |
175 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); | 175 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); |
176 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); | 176 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); |
177 | 177 |
178 testing_profile_manager.DeleteTestingProfile("p2"); | 178 testing_profile_manager.DeleteTestingProfile("p2"); |
179 } | 179 } |
OLD | NEW |