diff options
author | ricea <ricea@chromium.org> | 2015-08-19 02:32:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 09:32:33 +0000 |
commit | 7529916efbda5763f6b5ddd9256ea46e29065281 (patch) | |
tree | c39c9207203d8c51cbd733fed715164bb61b23ec /chrome/browser/ui/browser_command_controller_unittest.cc | |
parent | 70660a5b9dfba4823a505ecb916eccab440bfe35 (diff) | |
download | chromium_src-7529916efbda5763f6b5ddd9256ea46e29065281.zip chromium_src-7529916efbda5763f6b5ddd9256ea46e29065281.tar.gz chromium_src-7529916efbda5763f6b5ddd9256ea46e29065281.tar.bz2 |
Revert of Delete dead signin code (SigninGlobalError) (patchset #8 id:140001 of https://codereview.chromium.org/1299543002/ )
Reason for revert:
Broke the Mac10.9 Tests (dbg) bot:
http://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/10278
See the stack trace in the logs.
Original issue's description:
> Delete dead signin code (SigninGlobalError)
>
> BUG=none
>
> Committed: https://crrev.com/c91b178b07b0d9fb0c7a437df3a1da3db1887160
> Cr-Commit-Position: refs/heads/master@{#344176}
TBR=anthonyvd@chromium.org,sky@chromium.org,rogerta@chromium.org,estade@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=none
Review URL: https://codereview.chromium.org/1301583004
Cr-Commit-Position: refs/heads/master@{#344188}
Diffstat (limited to 'chrome/browser/ui/browser_command_controller_unittest.cc')
-rw-r--r-- | chrome/browser/ui/browser_command_controller_unittest.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc index 4629624..a80c758 100644 --- a/chrome/browser/ui/browser_command_controller_unittest.cc +++ b/chrome/browser/ui/browser_command_controller_unittest.cc @@ -139,6 +139,7 @@ TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKeyIsApp) { TEST_F(BrowserCommandControllerTest, IncognitoCommands) { EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); + EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_SIGNIN)); TestingProfile* testprofile = browser()->profile()->AsTestingProfile(); EXPECT_TRUE(testprofile); @@ -148,6 +149,7 @@ TEST_F(BrowserCommandControllerTest, IncognitoCommands) { browser()->command_controller()->command_updater(), testprofile); EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); + EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_SIGNIN)); testprofile->SetGuestSession(false); IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(), @@ -157,6 +159,7 @@ TEST_F(BrowserCommandControllerTest, IncognitoCommands) { browser()->command_controller()->command_updater(), testprofile); EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); + EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_SIGNIN)); } TEST_F(BrowserCommandControllerTest, AppFullScreen) { @@ -418,3 +421,35 @@ TEST_F(BrowserCommandControllerFullscreenTest, EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); } + +TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) { + // Set up a profile with an off the record profile. + scoped_ptr<TestingProfile> profile1 = TestingProfile::Builder().Build(); + Profile* profile2 = profile1->GetOffTheRecordProfile(); + + EXPECT_EQ(profile2->GetOriginalProfile(), profile1.get()); + + // Create a new browser based on the off the record profile. + Browser::CreateParams profile_params(profile1->GetOffTheRecordProfile(), + chrome::GetActiveDesktop()); + scoped_ptr<Browser> browser2( + chrome::CreateBrowserWithTestWindowForParams(&profile_params)); + + chrome::BrowserCommandController command_controller(browser2.get()); + const CommandUpdater* command_updater = command_controller.command_updater(); + + // Check that the SYNC_SETUP command is updated on preference change. + EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); + profile1->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); + EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); +} + +TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { + chrome::BrowserCommandController command_controller(browser()); + const CommandUpdater* command_updater = command_controller.command_updater(); + + // Check that the SYNC_SETUP command is updated on preference change. + EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); + profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); + EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); +} |