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

Unified Diff: chrome/browser/ui/browser_command_controller_unittest.cc

Issue 1301583004: Revert of Delete dead signin code (SigninGlobalError) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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));
+}
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698