Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: chrome/browser/ui/browser_command_controller_unittest.cc

Issue 340723002: Revert 277793 "Enable consistent identity on android platform by..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2056/src/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 204 EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
205 205
206 testing_profile_manager.DeleteTestingProfile("p2"); 206 testing_profile_manager.DeleteTestingProfile("p2");
207 } 207 }
208 208
209 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) { 209 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) {
210 if (!profiles::IsMultipleProfilesEnabled()) 210 if (!profiles::IsMultipleProfilesEnabled())
211 return; 211 return;
212 212
213 // The command line is reset at the end of every test by the test suite. 213 // The command line is reset at the end of every test by the test suite.
214 switches::EnableNewProfileManagementForTesting( 214 CommandLine::ForCurrentProcess()->AppendSwitch(
215 CommandLine::ForCurrentProcess()); 215 switches::kNewProfileManagement);
216 EXPECT_TRUE(switches::IsNewProfileManagement());
216 217
217 TestingProfileManager testing_profile_manager( 218 TestingProfileManager testing_profile_manager(
218 TestingBrowserProcess::GetGlobal()); 219 TestingBrowserProcess::GetGlobal());
219 ASSERT_TRUE(testing_profile_manager.SetUp()); 220 ASSERT_TRUE(testing_profile_manager.SetUp());
220 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); 221 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
221 222
222 chrome::BrowserCommandController command_controller(browser()); 223 chrome::BrowserCommandController command_controller(browser());
223 const CommandUpdater* command_updater = command_controller.command_updater(); 224 const CommandUpdater* command_updater = command_controller.command_updater();
224 225
225 testing_profile_manager.CreateTestingProfile("p1"); 226 testing_profile_manager.CreateTestingProfile("p1");
226 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles()); 227 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
227 #if defined(OS_CHROMEOS) 228 #if defined(OS_CHROMEOS)
228 // Chrome OS uses system tray menu to handle multi-profiles. 229 // Chrome OS uses system tray menu to handle multi-profiles.
229 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 230 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
230 #else 231 #else
231 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 232 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
232 #endif 233 #endif
233 testing_profile_manager.DeleteTestingProfile("p1"); 234 testing_profile_manager.DeleteTestingProfile("p1");
234 } 235 }
235 236
236 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledInGuestMode) { 237 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledInGuestMode) {
237 if (!profiles::IsMultipleProfilesEnabled()) 238 if (!profiles::IsMultipleProfilesEnabled())
238 return; 239 return;
239 240
240 // The command line is reset at the end of every test by the test suite. 241 // The command line is reset at the end of every test by the test suite.
241 switches::EnableNewProfileManagementForTesting( 242 CommandLine::ForCurrentProcess()->AppendSwitch(
242 CommandLine::ForCurrentProcess()); 243 switches::kNewProfileManagement);
244 EXPECT_TRUE(switches::IsNewProfileManagement());
243 245
244 TestingProfileManager testing_profile_manager( 246 TestingProfileManager testing_profile_manager(
245 TestingBrowserProcess::GetGlobal()); 247 TestingBrowserProcess::GetGlobal());
246 ASSERT_TRUE(testing_profile_manager.SetUp()); 248 ASSERT_TRUE(testing_profile_manager.SetUp());
247 249
248 // Set up guest a profile. 250 // Set up guest a profile.
249 TestingProfile::Builder guest_builder; 251 TestingProfile::Builder guest_builder;
250 guest_builder.SetIncognito(); // Guest profiles are off the record. 252 guest_builder.SetIncognito(); // Guest profiles are off the record.
251 guest_builder.SetGuestSession(); 253 guest_builder.SetGuestSession();
252 guest_builder.SetPath(ProfileManager::GetGuestProfilePath()); 254 guest_builder.SetPath(ProfileManager::GetGuestProfilePath());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 287
286 chrome::BrowserCommandController command_controller(otr_browser.get()); 288 chrome::BrowserCommandController command_controller(otr_browser.get());
287 const CommandUpdater* command_updater = command_controller.command_updater(); 289 const CommandUpdater* command_updater = command_controller.command_updater();
288 290
289 // The old style avatar menu should be disabled. 291 // The old style avatar menu should be disabled.
290 EXPECT_FALSE(switches::IsNewProfileManagement()); 292 EXPECT_FALSE(switches::IsNewProfileManagement());
291 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 293 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
292 294
293 // The new style avatar menu should also be disabled. 295 // The new style avatar menu should also be disabled.
294 // The command line is reset at the end of every test by the test suite. 296 // The command line is reset at the end of every test by the test suite.
295 switches::EnableNewProfileManagementForTesting( 297 CommandLine::ForCurrentProcess()->AppendSwitch(
296 CommandLine::ForCurrentProcess()); 298 switches::kNewProfileManagement);
299 EXPECT_TRUE(switches::IsNewProfileManagement());
297 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 300 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
298 } 301 }
299 302
300 ////////////////////////////////////////////////////////////////////////////// 303 //////////////////////////////////////////////////////////////////////////////
301 304
302 // A test browser window that can toggle fullscreen state. 305 // A test browser window that can toggle fullscreen state.
303 class FullscreenTestBrowserWindow : public TestBrowserWindow { 306 class FullscreenTestBrowserWindow : public TestBrowserWindow {
304 public: 307 public:
305 FullscreenTestBrowserWindow() : fullscreen_(false) {} 308 FullscreenTestBrowserWindow() : fullscreen_(false) {}
306 virtual ~FullscreenTestBrowserWindow() {} 309 virtual ~FullscreenTestBrowserWindow() {}
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 459
457 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { 460 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) {
458 chrome::BrowserCommandController command_controller(browser()); 461 chrome::BrowserCommandController command_controller(browser());
459 const CommandUpdater* command_updater = command_controller.command_updater(); 462 const CommandUpdater* command_updater = command_controller.command_updater();
460 463
461 // Check that the SYNC_SETUP command is updated on preference change. 464 // Check that the SYNC_SETUP command is updated on preference change.
462 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 465 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
463 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 466 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
464 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 467 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
465 } 468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698