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

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

Issue 2685333005: ash: fix regression where ctrl+n put new window on wrong desktop (Closed)
Patch Set: We have both kinds of compile fixes: mac and windows Created 3 years, 10 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
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) { 224 TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) {
225 if (!profiles::IsMultipleProfilesEnabled()) 225 if (!profiles::IsMultipleProfilesEnabled())
226 return; 226 return;
227 227
228 // Set up a profile with an off the record profile. 228 // Set up a profile with an off the record profile.
229 TestingProfile::Builder normal_builder; 229 TestingProfile::Builder normal_builder;
230 std::unique_ptr<TestingProfile> original_profile = normal_builder.Build(); 230 std::unique_ptr<TestingProfile> original_profile = normal_builder.Build();
231 231
232 // Create a new browser based on the off the record profile. 232 // Create a new browser based on the off the record profile.
233 Browser::CreateParams profile_params( 233 Browser::CreateParams profile_params(
234 original_profile->GetOffTheRecordProfile()); 234 original_profile->GetOffTheRecordProfile(), true);
235 std::unique_ptr<Browser> otr_browser( 235 std::unique_ptr<Browser> otr_browser(
236 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); 236 chrome::CreateBrowserWithTestWindowForParams(&profile_params));
237 237
238 chrome::BrowserCommandController command_controller(otr_browser.get()); 238 chrome::BrowserCommandController command_controller(otr_browser.get());
239 const CommandUpdater* command_updater = command_controller.command_updater(); 239 const CommandUpdater* command_updater = command_controller.command_updater();
240 240
241 // The avatar menu should be disabled. 241 // The avatar menu should be disabled.
242 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 242 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
243 // The command line is reset at the end of every test by the test suite. 243 // The command line is reset at the end of every test by the test suite.
244 } 244 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 416 }
417 417
418 TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) { 418 TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
419 // Set up a profile with an off the record profile. 419 // Set up a profile with an off the record profile.
420 std::unique_ptr<TestingProfile> profile1 = TestingProfile::Builder().Build(); 420 std::unique_ptr<TestingProfile> profile1 = TestingProfile::Builder().Build();
421 Profile* profile2 = profile1->GetOffTheRecordProfile(); 421 Profile* profile2 = profile1->GetOffTheRecordProfile();
422 422
423 EXPECT_EQ(profile2->GetOriginalProfile(), profile1.get()); 423 EXPECT_EQ(profile2->GetOriginalProfile(), profile1.get());
424 424
425 // Create a new browser based on the off the record profile. 425 // Create a new browser based on the off the record profile.
426 Browser::CreateParams profile_params(profile1->GetOffTheRecordProfile()); 426 Browser::CreateParams profile_params(profile1->GetOffTheRecordProfile(),
427 true);
427 std::unique_ptr<Browser> browser2( 428 std::unique_ptr<Browser> browser2(
428 chrome::CreateBrowserWithTestWindowForParams(&profile_params)); 429 chrome::CreateBrowserWithTestWindowForParams(&profile_params));
429 430
430 chrome::BrowserCommandController command_controller(browser2.get()); 431 chrome::BrowserCommandController command_controller(browser2.get());
431 const CommandUpdater* command_updater = command_controller.command_updater(); 432 const CommandUpdater* command_updater = command_controller.command_updater();
432 433
433 // Check that the SYNC_SETUP command is updated on preference change. 434 // Check that the SYNC_SETUP command is updated on preference change.
434 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 435 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
435 profile1->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 436 profile1->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
436 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 437 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
437 } 438 }
438 439
439 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { 440 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) {
440 chrome::BrowserCommandController command_controller(browser()); 441 chrome::BrowserCommandController command_controller(browser());
441 const CommandUpdater* command_updater = command_controller.command_updater(); 442 const CommandUpdater* command_updater = command_controller.command_updater();
442 443
443 // Check that the SYNC_SETUP command is updated on preference change. 444 // Check that the SYNC_SETUP command is updated on preference change.
444 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 445 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
445 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 446 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
446 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 447 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
447 } 448 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698