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

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

Issue 2701973002: Fix an inconsistent behavior in BrowserCommandController (Closed)
Patch Set: Resolve review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ee63765fe5508834673edd0e6ad399b019dc081d..1c56ec9b3bf4830dfd23f90576718ebabbd706b7 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -448,6 +448,32 @@ TEST_F(BrowserCommandControllerFullscreenTest,
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS));
}
+// Ensure that the logic for enabling IDC_OPTIONS is consistent, regardless of
+// the order of entering fullscreen and forced incognito modes. See
+// http://crbug.com/694331.
+TEST_F(BrowserCommandControllerTest, OptionsConsistency) {
+ TestingProfile* profile = browser()->profile()->AsTestingProfile();
+ // Setup guest session.
+ profile->SetGuestSession(true);
+ // Setup forced incognito mode.
+ IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::FORCED);
+ EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
+ // Enter fullscreen.
+ browser()->command_controller()->FullscreenStateChanged();
+ EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
+ // Exit fullscreen
+ browser()->command_controller()->FullscreenStateChanged();
+ EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
+ // Reenter incognito mode, this should trigger
+ // UpdateSharedCommandsForIncognitoAvailability() again.
+ IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::FORCED);
+ EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
+}
+
TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
// Set up a profile with an off the record profile.
std::unique_ptr<TestingProfile> profile1 = TestingProfile::Builder().Build();
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698