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

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

Issue 18615010: Refactor utility methods out of the ProfileManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unbreak rebase and added new static fn from trunk Created 7 years, 5 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
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/profiles/profile_destroyer.h" 10 #include "chrome/browser/profiles/profile_destroyer.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/profiles/profiles_state.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_commands.h" 14 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/browser/ui/browser_window_state.h" 15 #include "chrome/browser/ui/browser_window_state.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/browser_with_test_window_test.h" 17 #include "chrome/test/base/browser_with_test_window_test.h"
17 #include "chrome/test/base/test_browser_window.h" 18 #include "chrome/test/base/test_browser_window.h"
18 #include "chrome/test/base/testing_browser_process.h" 19 #include "chrome/test/base/testing_browser_process.h"
19 #include "chrome/test/base/testing_profile_manager.h" 20 #include "chrome/test/base/testing_profile_manager.h"
20 #include "content/public/browser/native_web_keyboard_event.h" 21 #include "content/public/browser/native_web_keyboard_event.h"
21 #include "ui/base/keycodes/keyboard_codes.h" 22 #include "ui/base/keycodes/keyboard_codes.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 135 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
135 136
136 // Enabled for app windows. 137 // Enabled for app windows.
137 browser()->app_name_ = "app"; 138 browser()->app_name_ = "app";
138 ASSERT_TRUE(browser()->is_app()); 139 ASSERT_TRUE(browser()->is_app());
139 browser()->command_controller()->FullscreenStateChanged(); 140 browser()->command_controller()->FullscreenStateChanged();
140 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 141 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
141 } 142 }
142 143
143 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) { 144 TEST_F(BrowserCommandControllerTest, AvatarMenuDisabledWhenOnlyOneProfile) {
144 if (!ProfileManager::IsMultipleProfilesEnabled()) 145 if (!profiles::IsMultipleProfilesEnabled())
145 return; 146 return;
146 147
147 TestingProfileManager testing_profile_manager( 148 TestingProfileManager testing_profile_manager(
148 TestingBrowserProcess::GetGlobal()); 149 TestingBrowserProcess::GetGlobal());
149 ASSERT_TRUE(testing_profile_manager.SetUp()); 150 ASSERT_TRUE(testing_profile_manager.SetUp());
150 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); 151 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
151 152
152 chrome::BrowserCommandController command_controller(browser(), 153 chrome::BrowserCommandController command_controller(browser(),
153 profile_manager); 154 profile_manager);
154 const CommandUpdater* command_updater = command_controller.command_updater(); 155 const CommandUpdater* command_updater = command_controller.command_updater();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 ProfileManager* profile_manager = testing_profile_manager.profile_manager(); 328 ProfileManager* profile_manager = testing_profile_manager.profile_manager();
328 chrome::BrowserCommandController command_controller(browser(), 329 chrome::BrowserCommandController command_controller(browser(),
329 profile_manager); 330 profile_manager);
330 const CommandUpdater* command_updater = command_controller.command_updater(); 331 const CommandUpdater* command_updater = command_controller.command_updater();
331 332
332 // Check that the SYNC_SETUP command is updated on preference change. 333 // Check that the SYNC_SETUP command is updated on preference change.
333 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 334 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
334 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 335 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
335 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 336 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
336 } 337 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profiles_state.cc ('k') | chrome/browser/ui/gtk/gtk_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698