diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-11 12:23:04 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-11 12:24:14 +0000 |
commit | 18953a234c906f27e6344c45f444a8a779aa18c2 (patch) | |
tree | e16f51edae60cc0417c5367d7ef7411262d2631f /chrome/browser/ui/browser_command_controller_unittest.cc | |
parent | 2c153ec0dbe534a61603de3a639477f2e85c8453 (diff) | |
download | chromium_src-18953a234c906f27e6344c45f444a8a779aa18c2.zip chromium_src-18953a234c906f27e6344c45f444a8a779aa18c2.tar.gz chromium_src-18953a234c906f27e6344c45f444a8a779aa18c2.tar.bz2 |
Disable New Avatar Menu in unit tests where necessary.
This makes the tests more robust to it getting enabled by default.
BUG=400667
Review URL: https://codereview.chromium.org/444653002
Cr-Commit-Position: refs/heads/master@{#288695}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288695 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 | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc index e906fcf..9fe9857 100644 --- a/chrome/browser/ui/browser_command_controller_unittest.cc +++ b/chrome/browser/ui/browser_command_controller_unittest.cc @@ -175,7 +175,9 @@ TEST_F(BrowserCommandControllerTest, OldAvatarMenuEnabledForOneOrMoreProfiles) { if (!profiles::IsMultipleProfilesEnabled()) return; - EXPECT_FALSE(switches::IsNewAvatarMenu()); + // The command line is reset at the end of every test by the test suite. + switches::DisableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); + ASSERT_FALSE(switches::IsNewAvatarMenu()); TestingProfileManager testing_profile_manager( TestingBrowserProcess::GetGlobal()); @@ -284,14 +286,15 @@ TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) { chrome::BrowserCommandController command_controller(otr_browser.get()); const CommandUpdater* command_updater = command_controller.command_updater(); - // The old style avatar menu should be disabled. - EXPECT_FALSE(switches::IsNewAvatarMenu()); + // Both the old style and the new style avatar menu should be disabled. EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); - - // The new style avatar menu should also be disabled. - // The command line is reset at the end of every test by the test suite. - switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); + if (switches::IsNewAvatarMenu()) { + switches::DisableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); + } else { + switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); + } EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); + // The command line is reset at the end of every test by the test suite. } ////////////////////////////////////////////////////////////////////////////// |