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_destroyer.h" | 10 #include "chrome/browser/profiles/profile_destroyer.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 TestingProfile::Builder builder; | 294 TestingProfile::Builder builder; |
295 TestingProfile* profile2 = builder.Build().release(); | 295 TestingProfile* profile2 = builder.Build().release(); |
296 profile2->set_incognito(true); | 296 profile2->set_incognito(true); |
297 TestingProfile::Builder builder2; | 297 TestingProfile::Builder builder2; |
298 TestingProfile* profile1 = builder2.Build().release(); | 298 TestingProfile* profile1 = builder2.Build().release(); |
299 profile2->SetOriginalProfile(profile1); | 299 profile2->SetOriginalProfile(profile1); |
300 EXPECT_EQ(profile2->GetOriginalProfile(), profile1); | 300 EXPECT_EQ(profile2->GetOriginalProfile(), profile1); |
301 profile1->SetOffTheRecordProfile(profile2); | 301 profile1->SetOffTheRecordProfile(profile2); |
302 | 302 |
303 // Create a new browser based on the off the record profile. | 303 // Create a new browser based on the off the record profile. |
304 Browser::CreateParams profile_params(profile2, | 304 Browser::CreateParams profile_params(profile2, chrome::GetActiveDesktop()); |
305 chrome::HOST_DESKTOP_TYPE_NATIVE); | |
306 scoped_ptr<Browser> browser2( | 305 scoped_ptr<Browser> browser2( |
307 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); | 306 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); |
308 | 307 |
309 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 308 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
310 chrome::BrowserCommandController* command_controller = | 309 chrome::BrowserCommandController* command_controller = |
311 new chrome::BrowserCommandController(browser2.get(), profile_manager); | 310 new chrome::BrowserCommandController(browser2.get(), profile_manager); |
312 const CommandUpdater* command_updater = command_controller->command_updater(); | 311 const CommandUpdater* command_updater = command_controller->command_updater(); |
313 | 312 |
314 // Check that the SYNC_SETUP command is updated on preference change. | 313 // Check that the SYNC_SETUP command is updated on preference change. |
315 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 314 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
(...skipping 12 matching lines...) Expand all Loading... |
328 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); | 327 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); |
329 chrome::BrowserCommandController command_controller(browser(), | 328 chrome::BrowserCommandController command_controller(browser(), |
330 profile_manager); | 329 profile_manager); |
331 const CommandUpdater* command_updater = command_controller.command_updater(); | 330 const CommandUpdater* command_updater = command_controller.command_updater(); |
332 | 331 |
333 // Check that the SYNC_SETUP command is updated on preference change. | 332 // Check that the SYNC_SETUP command is updated on preference change. |
334 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 333 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
335 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 334 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
336 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 335 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
337 } | 336 } |
OLD | NEW |