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 "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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) { | 234 TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) { |
235 if (!profiles::IsMultipleProfilesEnabled()) | 235 if (!profiles::IsMultipleProfilesEnabled()) |
236 return; | 236 return; |
237 | 237 |
238 TestingProfileManager testing_profile_manager( | 238 TestingProfileManager testing_profile_manager( |
239 TestingBrowserProcess::GetGlobal()); | 239 TestingBrowserProcess::GetGlobal()); |
240 ASSERT_TRUE(testing_profile_manager.SetUp()); | 240 ASSERT_TRUE(testing_profile_manager.SetUp()); |
241 | 241 |
242 // Set up a profile with an off the record profile. | 242 // Set up a profile with an off the record profile. |
243 TestingProfile::Builder otr_builder; | |
244 otr_builder.SetIncognito(); | |
245 scoped_ptr<TestingProfile> otr_profile(otr_builder.Build()); | |
246 | |
247 TestingProfile::Builder normal_builder; | 243 TestingProfile::Builder normal_builder; |
248 scoped_ptr<TestingProfile> original_profile = normal_builder.Build(); | 244 scoped_ptr<TestingProfile> original_profile = normal_builder.Build(); |
249 otr_profile->SetOriginalProfile(original_profile.get()); | |
250 EXPECT_EQ(otr_profile->GetOriginalProfile(), original_profile.get()); | |
251 | |
252 original_profile->SetOffTheRecordProfile(otr_profile.PassAs<Profile>()); | |
253 | 245 |
254 // Create a new browser based on the off the record profile. | 246 // Create a new browser based on the off the record profile. |
255 Browser::CreateParams profile_params( | 247 Browser::CreateParams profile_params( |
256 original_profile->GetOffTheRecordProfile(), chrome::GetActiveDesktop()); | 248 original_profile->GetOffTheRecordProfile(), chrome::GetActiveDesktop()); |
257 scoped_ptr<Browser> otr_browser( | 249 scoped_ptr<Browser> otr_browser( |
258 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); | 250 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); |
259 | 251 |
260 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 252 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
261 chrome::BrowserCommandController command_controller(otr_browser.get(), | 253 chrome::BrowserCommandController command_controller(otr_browser.get(), |
262 profile_manager); | 254 profile_manager); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 429 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
438 chrome::BrowserCommandController command_controller(browser(), | 430 chrome::BrowserCommandController command_controller(browser(), |
439 profile_manager); | 431 profile_manager); |
440 const CommandUpdater* command_updater = command_controller.command_updater(); | 432 const CommandUpdater* command_updater = command_controller.command_updater(); |
441 | 433 |
442 // Check that the SYNC_SETUP command is updated on preference change. | 434 // Check that the SYNC_SETUP command is updated on preference change. |
443 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 435 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
444 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 436 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
445 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 437 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
446 } | 438 } |
OLD | NEW |