diff options
author | bcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-01 16:31:06 +0000 |
---|---|---|
committer | bcwhite@chromium.org <bcwhite@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-01 16:31:06 +0000 |
commit | 57b25299665ec2328b56515aeca7fc1033ba70c5 (patch) | |
tree | 32db00527aaa8e8e0f386132efcf2b4f09d89942 /chrome/browser/ui/browser_command_controller_unittest.cc | |
parent | 99691073b9f7144f810489602726c6cea66954bb (diff) | |
download | chromium_src-57b25299665ec2328b56515aeca7fc1033ba70c5.zip chromium_src-57b25299665ec2328b56515aeca7fc1033ba70c5.tar.gz chromium_src-57b25299665ec2328b56515aeca7fc1033ba70c5.tar.bz2 |
Settings should be enabled even in Guest mode
BUG=362381
Review URL: https://codereview.chromium.org/259653002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_command_controller_unittest.cc')
-rw-r--r-- | chrome/browser/ui/browser_command_controller_unittest.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc index 449723d..b080e71 100644 --- a/chrome/browser/ui/browser_command_controller_unittest.cc +++ b/chrome/browser/ui/browser_command_controller_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/command_updater.h" +#include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/ui/browser.h" @@ -133,6 +134,32 @@ TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKeyIsApp) { #endif // USE_AURA } +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); + testprofile->SetGuestSession(true); + chrome::BrowserCommandController + ::UpdateSharedCommandsForIncognitoAvailability( + 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(), + IncognitoModePrefs::FORCED); + chrome::BrowserCommandController + ::UpdateSharedCommandsForIncognitoAvailability( + 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) { // Enable for tabbed browser. EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); @@ -433,7 +460,8 @@ TEST_F(BrowserCommandControllerFullscreenTest, testprofile->SetGuestSession(true); browser()->command_controller()->FullscreenStateChanged(); - EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); + EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); + EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); } TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) { |