Index: chrome/browser/ui/browser_command_controller_unittest.cc |
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc |
index 4629624bc050e4d4cc229d74d0400756f034a378..a80c7580269c2bda4d415bcf53fdbd1e101d70e7 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, 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 @@ |
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 @@ |
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 @@ |
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)); |
+} |