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

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

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 4 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 "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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 286 }
287 287
288 TEST_F(BrowserCommandControllerTest, 288 TEST_F(BrowserCommandControllerTest,
289 IncognitoModeOnSigninAllowedPrefChange) { 289 IncognitoModeOnSigninAllowedPrefChange) {
290 TestingProfileManager testing_profile_manager( 290 TestingProfileManager testing_profile_manager(
291 TestingBrowserProcess::GetGlobal()); 291 TestingBrowserProcess::GetGlobal());
292 ASSERT_TRUE(testing_profile_manager.SetUp()); 292 ASSERT_TRUE(testing_profile_manager.SetUp());
293 293
294 // Set up a profile with an off the record profile. 294 // Set up a profile with an off the record profile.
295 TestingProfile::Builder builder; 295 TestingProfile::Builder builder;
296 TestingProfile* profile2 = builder.Build().release(); 296 builder.SetIncognito();
297 profile2->set_incognito(true); 297 scoped_ptr<TestingProfile> profile2(builder.Build());
298 TestingProfile::Builder builder2; 298 TestingProfile::Builder builder2;
299 TestingProfile* profile1 = builder2.Build().release(); 299 TestingProfile* profile1 = builder2.Build().release();
300 profile2->SetOriginalProfile(profile1); 300 profile2->SetOriginalProfile(profile1);
301 EXPECT_EQ(profile2->GetOriginalProfile(), profile1); 301 EXPECT_EQ(profile2->GetOriginalProfile(), profile1);
302 profile1->SetOffTheRecordProfile(profile2); 302 profile1->SetOffTheRecordProfile(profile2.PassAs<Profile>());
303 303
304 // Create a new browser based on the off the record profile. 304 // Create a new browser based on the off the record profile.
305 Browser::CreateParams profile_params(profile2, chrome::GetActiveDesktop()); 305 Browser::CreateParams profile_params(profile1->GetOffTheRecordProfile(),
306 chrome::GetActiveDesktop());
306 scoped_ptr<Browser> browser2( 307 scoped_ptr<Browser> browser2(
307 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); 308 chrome::CreateBrowserWithTestWindowForParams(&profile_params));
308 309
309 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); 310 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
310 chrome::BrowserCommandController* command_controller = 311 chrome::BrowserCommandController* command_controller =
311 new chrome::BrowserCommandController(browser2.get(), profile_manager); 312 new chrome::BrowserCommandController(browser2.get(), profile_manager);
312 const CommandUpdater* command_updater = command_controller->command_updater(); 313 const CommandUpdater* command_updater = command_controller->command_updater();
313 314
314 // Check that the SYNC_SETUP command is updated on preference change. 315 // Check that the SYNC_SETUP command is updated on preference change.
315 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 316 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
(...skipping 12 matching lines...) Expand all
328 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); 329 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
329 chrome::BrowserCommandController command_controller(browser(), 330 chrome::BrowserCommandController command_controller(browser(),
330 profile_manager); 331 profile_manager);
331 const CommandUpdater* command_updater = command_controller.command_updater(); 332 const CommandUpdater* command_updater = command_controller.command_updater();
332 333
333 // Check that the SYNC_SETUP command is updated on preference change. 334 // Check that the SYNC_SETUP command is updated on preference change.
334 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 335 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
335 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 336 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
336 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 337 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
337 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698