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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_command_controller.h"
7 #include "base/command_line.h"
8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/command_updater.h"
11 #include "chrome/browser/prefs/incognito_mode_prefs.h"
12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/profiles/profiles_state.h"
14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_window_state.h"
17 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/browser_with_test_window_test.h"
22 #include "chrome/test/base/test_browser_window.h"
23 #include "chrome/test/base/testing_browser_process.h"
24 #include "chrome/test/base/testing_profile.h"
25 #include "chrome/test/base/testing_profile_manager.h"
26 #include "components/signin/core/common/profile_management_switches.h"
27 #include "content/public/browser/native_web_keyboard_event.h"
28 #include "ui/events/keycodes/keyboard_codes.h"
30 typedef BrowserWithTestWindowTest BrowserCommandControllerTest
;
32 TEST_F(BrowserCommandControllerTest
, IsReservedCommandOrKey
) {
33 #if defined(OS_CHROMEOS)
34 // F1-3 keys are reserved Chrome accelerators on Chrome OS.
35 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
36 IDC_BACK
, content::NativeWebKeyboardEvent(
37 ui::ET_KEY_PRESSED
, false, ui::VKEY_BROWSER_BACK
, 0, 0)));
38 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
39 IDC_FORWARD
, content::NativeWebKeyboardEvent(
40 ui::ET_KEY_PRESSED
, false, ui::VKEY_BROWSER_FORWARD
, 0, 0)));
41 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
42 IDC_RELOAD
, content::NativeWebKeyboardEvent(
43 ui::ET_KEY_PRESSED
, false, ui::VKEY_BROWSER_REFRESH
, 0, 0)));
45 // When there are modifier keys pressed, don't reserve.
46 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
47 IDC_RELOAD_IGNORING_CACHE
, content::NativeWebKeyboardEvent(
48 ui::ET_KEY_PRESSED
, false, ui::VKEY_F3
, ui::EF_SHIFT_DOWN
, 0)));
49 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
50 IDC_RELOAD_IGNORING_CACHE
, content::NativeWebKeyboardEvent(
51 ui::ET_KEY_PRESSED
, false, ui::VKEY_F3
, ui::EF_CONTROL_DOWN
, 0)));
52 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
53 IDC_FULLSCREEN
, content::NativeWebKeyboardEvent(
54 ui::ET_KEY_PRESSED
, false, ui::VKEY_F4
, ui::EF_SHIFT_DOWN
, 0)));
56 // F4-10 keys are not reserved since they are Ash accelerators.
57 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
58 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
60 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
61 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
63 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
64 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
66 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
67 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
69 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
70 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
72 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
73 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
75 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
76 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
77 ui::VKEY_F10
, 0, 0)));
79 // Shift+Control+Alt+F3 is also an Ash accelerator. Don't reserve it.
80 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
81 -1, content::NativeWebKeyboardEvent(
82 ui::ET_KEY_PRESSED
, false,
84 ui::EF_SHIFT_DOWN
| ui::EF_CONTROL_DOWN
| ui::EF_ALT_DOWN
, 0)));
88 // Ctrl+n, Ctrl+w are reserved while Ctrl+f is not.
90 // The content::NativeWebKeyboardEvent constructor is available only when
91 // USE_AURA is #defined.
92 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
93 IDC_NEW_WINDOW
, content::NativeWebKeyboardEvent(
94 ui::ET_KEY_PRESSED
, false, ui::VKEY_N
, ui::EF_CONTROL_DOWN
, 0)));
95 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
96 IDC_CLOSE_TAB
, content::NativeWebKeyboardEvent(
97 ui::ET_KEY_PRESSED
, false, ui::VKEY_W
, ui::EF_CONTROL_DOWN
, 0)));
98 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
99 IDC_FIND
, content::NativeWebKeyboardEvent(
100 ui::ET_KEY_PRESSED
, false, ui::VKEY_F
, ui::EF_CONTROL_DOWN
, 0)));
104 TEST_F(BrowserCommandControllerTest
, IsReservedCommandOrKeyIsApp
) {
105 browser()->app_name_
= "app";
106 ASSERT_TRUE(browser()->is_app());
108 // When is_app(), no keys are reserved.
109 #if defined(OS_CHROMEOS)
110 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
111 IDC_BACK
, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
112 ui::VKEY_F1
, 0, 0)));
113 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
114 IDC_FORWARD
, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
115 ui::VKEY_F2
, 0, 0)));
116 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
117 IDC_RELOAD
, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
118 ui::VKEY_F3
, 0, 0)));
119 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
120 -1, content::NativeWebKeyboardEvent(ui::ET_KEY_PRESSED
, false,
121 ui::VKEY_F4
, 0, 0)));
122 #endif // OS_CHROMEOS
124 #if defined(USE_AURA)
125 // The content::NativeWebKeyboardEvent constructor is available only when
126 // USE_AURA is #defined.
127 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
128 IDC_NEW_WINDOW
, content::NativeWebKeyboardEvent(
129 ui::ET_KEY_PRESSED
, false, ui::VKEY_N
, ui::EF_CONTROL_DOWN
, 0)));
130 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
131 IDC_CLOSE_TAB
, content::NativeWebKeyboardEvent(
132 ui::ET_KEY_PRESSED
, false, ui::VKEY_W
, ui::EF_CONTROL_DOWN
, 0)));
133 EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
134 IDC_FIND
, content::NativeWebKeyboardEvent(
135 ui::ET_KEY_PRESSED
, false, ui::VKEY_F
, ui::EF_CONTROL_DOWN
, 0)));
139 TEST_F(BrowserCommandControllerTest
, IncognitoCommands
) {
140 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
141 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
143 TestingProfile
* testprofile
= browser()->profile()->AsTestingProfile();
144 EXPECT_TRUE(testprofile
);
145 testprofile
->SetGuestSession(true);
146 chrome::BrowserCommandController
147 ::UpdateSharedCommandsForIncognitoAvailability(
148 browser()->command_controller()->command_updater(), testprofile
);
149 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
150 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
152 testprofile
->SetGuestSession(false);
153 IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
154 IncognitoModePrefs::FORCED
);
155 chrome::BrowserCommandController
156 ::UpdateSharedCommandsForIncognitoAvailability(
157 browser()->command_controller()->command_updater(), testprofile
);
158 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
159 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
162 TEST_F(BrowserCommandControllerTest
, AppFullScreen
) {
163 // Enable for tabbed browser.
164 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN
));
166 // Enabled for app windows.
167 browser()->app_name_
= "app";
168 ASSERT_TRUE(browser()->is_app());
169 browser()->command_controller()->FullscreenStateChanged();
170 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN
));
173 TEST_F(BrowserCommandControllerTest
, OldAvatarMenuEnabledForOneOrMoreProfiles
) {
174 if (!profiles::IsMultipleProfilesEnabled())
177 // The command line is reset at the end of every test by the test suite.
178 switches::DisableNewAvatarMenuForTesting(
179 base::CommandLine::ForCurrentProcess());
180 ASSERT_FALSE(switches::IsNewAvatarMenu());
182 TestingProfileManager
testing_profile_manager(
183 TestingBrowserProcess::GetGlobal());
184 ASSERT_TRUE(testing_profile_manager
.SetUp());
185 ProfileManager
* profile_manager
= testing_profile_manager
.profile_manager();
187 chrome::BrowserCommandController
command_controller(browser());
188 const CommandUpdater
* command_updater
= command_controller
.command_updater();
191 #if defined(OS_CHROMEOS)
192 // Chrome OS uses system tray menu to handle multi-profiles.
196 testing_profile_manager
.CreateTestingProfile("p1");
197 ASSERT_EQ(1U, profile_manager
->GetNumberOfProfiles());
198 EXPECT_EQ(enabled
, command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
200 testing_profile_manager
.CreateTestingProfile("p2");
201 ASSERT_EQ(2U, profile_manager
->GetNumberOfProfiles());
202 EXPECT_EQ(enabled
, command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
204 testing_profile_manager
.DeleteTestingProfile("p1");
205 ASSERT_EQ(1U, profile_manager
->GetNumberOfProfiles());
206 EXPECT_EQ(enabled
, command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
208 testing_profile_manager
.DeleteTestingProfile("p2");
211 TEST_F(BrowserCommandControllerTest
, NewAvatarMenuEnabledWhenOnlyOneProfile
) {
212 if (!profiles::IsMultipleProfilesEnabled())
215 // The command line is reset at the end of every test by the test suite.
216 switches::EnableNewAvatarMenuForTesting(
217 base::CommandLine::ForCurrentProcess());
219 TestingProfileManager
testing_profile_manager(
220 TestingBrowserProcess::GetGlobal());
221 ASSERT_TRUE(testing_profile_manager
.SetUp());
222 ProfileManager
* profile_manager
= testing_profile_manager
.profile_manager();
224 chrome::BrowserCommandController
command_controller(browser());
225 const CommandUpdater
* command_updater
= command_controller
.command_updater();
227 testing_profile_manager
.CreateTestingProfile("p1");
228 ASSERT_EQ(1U, profile_manager
->GetNumberOfProfiles());
229 #if defined(OS_CHROMEOS)
230 // Chrome OS uses system tray menu to handle multi-profiles.
231 EXPECT_FALSE(command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
233 EXPECT_TRUE(command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
235 testing_profile_manager
.DeleteTestingProfile("p1");
238 TEST_F(BrowserCommandControllerTest
, AvatarMenuAlwaysDisabledInIncognitoMode
) {
239 if (!profiles::IsMultipleProfilesEnabled())
242 // Set up a profile with an off the record profile.
243 TestingProfile::Builder normal_builder
;
244 scoped_ptr
<TestingProfile
> original_profile
= normal_builder
.Build();
246 // Create a new browser based on the off the record profile.
247 Browser::CreateParams
profile_params(
248 original_profile
->GetOffTheRecordProfile(), chrome::GetActiveDesktop());
249 scoped_ptr
<Browser
> otr_browser(
250 chrome::CreateBrowserWithTestWindowForParams(&profile_params
));
252 chrome::BrowserCommandController
command_controller(otr_browser
.get());
253 const CommandUpdater
* command_updater
= command_controller
.command_updater();
255 // Both the old style and the new style avatar menu should be disabled.
256 EXPECT_FALSE(command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
257 if (switches::IsNewAvatarMenu()) {
258 switches::DisableNewAvatarMenuForTesting(
259 base::CommandLine::ForCurrentProcess());
261 switches::EnableNewAvatarMenuForTesting(
262 base::CommandLine::ForCurrentProcess());
264 EXPECT_FALSE(command_updater
->IsCommandEnabled(IDC_SHOW_AVATAR_MENU
));
265 // The command line is reset at the end of every test by the test suite.
268 //////////////////////////////////////////////////////////////////////////////
269 class BrowserCommandControllerFullscreenTest
;
271 // A test browser window that can toggle fullscreen state.
272 class FullscreenTestBrowserWindow
: public TestBrowserWindow
,
273 ExclusiveAccessContext
{
275 FullscreenTestBrowserWindow(
276 BrowserCommandControllerFullscreenTest
* test_browser
)
277 : fullscreen_(false), test_browser_(test_browser
) {}
279 ~FullscreenTestBrowserWindow() override
{}
281 // TestBrowserWindow overrides:
282 bool ShouldHideUIForFullscreen() const override
{ return fullscreen_
; }
283 bool IsFullscreen() const override
{ return fullscreen_
; }
284 void EnterFullscreen(const GURL
& url
,
285 ExclusiveAccessBubbleType type
,
286 bool with_toolbar
) override
{
289 void ExitFullscreen() override
{ fullscreen_
= false; }
291 ExclusiveAccessContext
* GetExclusiveAccessContext() override
{ return this; }
293 // Exclusive access interface:
294 Profile
* GetProfile() override
;
295 content::WebContents
* GetActiveWebContents() override
;
296 void HideDownloadShelf() override
{}
297 void UnhideDownloadShelf() override
{}
298 void UpdateExclusiveAccessExitBubbleContent(
300 ExclusiveAccessBubbleType bubble_type
) override
{}
301 bool IsFullscreenWithToolbar() const override
{ return IsFullscreen(); }
305 BrowserCommandControllerFullscreenTest
* test_browser_
;
307 DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow
);
310 // Test that uses FullscreenTestBrowserWindow for its window.
311 class BrowserCommandControllerFullscreenTest
312 : public BrowserWithTestWindowTest
{
314 BrowserCommandControllerFullscreenTest() {}
315 ~BrowserCommandControllerFullscreenTest() override
{}
317 Browser
* GetBrowser() { return BrowserWithTestWindowTest::browser(); }
319 // BrowserWithTestWindowTest overrides:
320 BrowserWindow
* CreateBrowserWindow() override
{
321 return new FullscreenTestBrowserWindow(this);
325 DISALLOW_COPY_AND_ASSIGN(BrowserCommandControllerFullscreenTest
);
328 Profile
* FullscreenTestBrowserWindow::GetProfile() {
329 return test_browser_
->GetBrowser()->profile();
332 content::WebContents
* FullscreenTestBrowserWindow::GetActiveWebContents() {
333 return test_browser_
->GetBrowser()->tab_strip_model()->GetActiveWebContents();
336 TEST_F(BrowserCommandControllerFullscreenTest
,
337 UpdateCommandsForFullscreenMode
) {
338 // Defaults for a tabbed browser.
339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL
));
340 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB
));
341 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR
));
342 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION
));
343 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH
));
344 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR
));
345 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE
));
346 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE
));
347 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS
));
348 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU
));
349 #if defined(GOOGLE_CHROME_BUILD)
350 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK
));
352 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
353 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
354 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES
));
355 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS
));
356 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT
));
357 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU
));
358 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN
));
360 // Simulate going fullscreen.
361 chrome::ToggleFullscreenMode(browser());
362 ASSERT_TRUE(browser()->window()->IsFullscreen());
363 browser()->command_controller()->FullscreenStateChanged();
365 // Most commands are disabled in fullscreen.
366 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL
));
367 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB
));
368 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR
));
369 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION
));
370 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH
));
371 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR
));
372 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE
));
373 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE
));
374 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS
));
375 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU
));
376 #if defined(GOOGLE_CHROME_BUILD)
377 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK
));
379 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
380 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
381 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES
));
382 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS
));
383 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ABOUT
));
384 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU
));
385 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN
));
388 chrome::ToggleFullscreenMode(browser());
389 ASSERT_FALSE(browser()->window()->IsFullscreen());
390 browser()->command_controller()->FullscreenStateChanged();
391 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL
));
392 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB
));
393 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR
));
394 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION
));
395 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH
));
396 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR
));
397 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE
));
398 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE
));
399 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS
));
400 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU
));
401 #if defined(GOOGLE_CHROME_BUILD)
402 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK
));
404 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
405 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));
406 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES
));
407 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS
));
408 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT
));
409 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU
));
410 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN
));
412 // Guest Profiles disallow some options.
413 TestingProfile
* testprofile
= browser()->profile()->AsTestingProfile();
414 EXPECT_TRUE(testprofile
);
415 testprofile
->SetGuestSession(true);
417 browser()->command_controller()->FullscreenStateChanged();
418 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS
));
419 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS
));