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

Side by Side Diff: chrome/browser/ui/browser_command_controller_unittest.cc

Issue 1124383004: Removes the new-avatar-menu flags, enabling the feature for all users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/command_updater.h" 10 #include "chrome/browser/command_updater.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Enable for tabbed browser. 166 // Enable for tabbed browser.
167 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 167 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
168 168
169 // Enabled for app windows. 169 // Enabled for app windows.
170 browser()->app_name_ = "app"; 170 browser()->app_name_ = "app";
171 ASSERT_TRUE(browser()->is_app()); 171 ASSERT_TRUE(browser()->is_app());
172 browser()->command_controller()->FullscreenStateChanged(); 172 browser()->command_controller()->FullscreenStateChanged();
173 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 173 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
174 } 174 }
175 175
176 TEST_F(BrowserCommandControllerTest, OldAvatarMenuEnabledForOneOrMoreProfiles) {
177 if (!profiles::IsMultipleProfilesEnabled())
178 return;
179
180 // The command line is reset at the end of every test by the test suite.
181 switches::DisableNewAvatarMenuForTesting(
182 base::CommandLine::ForCurrentProcess());
183 ASSERT_FALSE(switches::IsNewAvatarMenu());
184
185 TestingProfileManager testing_profile_manager(
186 TestingBrowserProcess::GetGlobal());
187 ASSERT_TRUE(testing_profile_manager.SetUp());
188 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
189
190 chrome::BrowserCommandController command_controller(browser());
191 const CommandUpdater* command_updater = command_controller.command_updater();
192
193 bool enabled = true;
194 #if defined(OS_CHROMEOS)
195 // Chrome OS uses system tray menu to handle multi-profiles.
196 enabled = false;
197 #endif
198
199 testing_profile_manager.CreateTestingProfile("p1");
200 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
201 EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
202
203 testing_profile_manager.CreateTestingProfile("p2");
204 ASSERT_EQ(2U, profile_manager->GetNumberOfProfiles());
205 EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
206
207 testing_profile_manager.DeleteTestingProfile("p1");
208 ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
209 EXPECT_EQ(enabled, command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
210
211 testing_profile_manager.DeleteTestingProfile("p2");
212 }
213
214 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) { 176 TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) {
215 if (!profiles::IsMultipleProfilesEnabled()) 177 if (!profiles::IsMultipleProfilesEnabled())
216 return; 178 return;
217 179
218 // The command line is reset at the end of every test by the test suite. 180 // The command line is reset at the end of every test by the test suite.
219 switches::EnableNewAvatarMenuForTesting( 181 switches::EnableNewAvatarMenuForTesting(
220 base::CommandLine::ForCurrentProcess()); 182 base::CommandLine::ForCurrentProcess());
221 183
222 TestingProfileManager testing_profile_manager( 184 TestingProfileManager testing_profile_manager(
223 TestingBrowserProcess::GetGlobal()); 185 TestingBrowserProcess::GetGlobal());
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 408
447 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { 409 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) {
448 chrome::BrowserCommandController command_controller(browser()); 410 chrome::BrowserCommandController command_controller(browser());
449 const CommandUpdater* command_updater = command_controller.command_updater(); 411 const CommandUpdater* command_updater = command_controller.command_updater();
450 412
451 // Check that the SYNC_SETUP command is updated on preference change. 413 // Check that the SYNC_SETUP command is updated on preference change.
452 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 414 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
453 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 415 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
454 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 416 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
455 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698