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_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | 321 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); |
322 } | 322 } |
323 | 323 |
324 TEST_F(BrowserCommandControllerTest, | 324 TEST_F(BrowserCommandControllerTest, |
325 IncognitoModeOnSigninAllowedPrefChange) { | 325 IncognitoModeOnSigninAllowedPrefChange) { |
326 TestingProfileManager testing_profile_manager( | 326 TestingProfileManager testing_profile_manager( |
327 TestingBrowserProcess::GetGlobal()); | 327 TestingBrowserProcess::GetGlobal()); |
328 ASSERT_TRUE(testing_profile_manager.SetUp()); | 328 ASSERT_TRUE(testing_profile_manager.SetUp()); |
329 | 329 |
330 // Set up a profile with an off the record profile. | 330 // Set up a profile with an off the record profile. |
331 TestingProfile* profile2 = new TestingProfile(); | 331 TestingProfile::Builder builder; |
332 TestingProfile* profile2 = builder.Build().release(); | |
sky
2013/03/08 16:08:05
I'm not familiar with TestingPRofile::Builder, who
Adrian Kuegel
2013/03/08 16:28:54
Build() returns a scoped_ptr. So I assume with thi
| |
332 profile2->set_incognito(true); | 333 profile2->set_incognito(true); |
333 TestingProfile* profile1 = | 334 TestingProfile* profile1 = |
334 testing_profile_manager.CreateTestingProfile("p1"); | 335 testing_profile_manager.CreateTestingProfile("p1"); |
335 profile2->SetOriginalProfile(profile1); | 336 profile2->SetOriginalProfile(profile1); |
336 EXPECT_EQ(profile2->GetOriginalProfile(), profile1); | 337 EXPECT_EQ(profile2->GetOriginalProfile(), profile1); |
337 profile1->SetOffTheRecordProfile(profile2); | 338 profile1->SetOffTheRecordProfile(profile2); |
338 // Create a new browser based on the off the record profile. | 339 // Create a new browser based on the off the record profile. |
339 Browser::CreateParams profile_params(profile2, | 340 Browser::CreateParams profile_params(profile2, |
340 chrome::HOST_DESKTOP_TYPE_NATIVE); | 341 chrome::HOST_DESKTOP_TYPE_NATIVE); |
341 scoped_ptr<Browser> browser2( | 342 scoped_ptr<Browser> browser2( |
(...skipping 21 matching lines...) Expand all Loading... | |
363 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 364 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
364 chrome::BrowserCommandController command_controller(browser(), | 365 chrome::BrowserCommandController command_controller(browser(), |
365 profile_manager); | 366 profile_manager); |
366 const CommandUpdater* command_updater = command_controller.command_updater(); | 367 const CommandUpdater* command_updater = command_controller.command_updater(); |
367 | 368 |
368 // Check that the SYNC_SETUP command is updated on preference change. | 369 // Check that the SYNC_SETUP command is updated on preference change. |
369 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 370 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
370 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 371 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
371 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 372 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
372 } | 373 } |
OLD | NEW |