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

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

Issue 2781633003: Allow keyboard shortcuts can be captured by webpage when toolbar is not visible (Closed)
Patch Set: Resolve review comments Created 3 years, 8 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/ui/browser_command_controller.cc ('k') | chrome/browser/ui/browser_window.h » ('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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 ////////////////////////////////////////////////////////////////////////////// 246 //////////////////////////////////////////////////////////////////////////////
247 class BrowserCommandControllerFullscreenTest; 247 class BrowserCommandControllerFullscreenTest;
248 248
249 // A test browser window that can toggle fullscreen state. 249 // A test browser window that can toggle fullscreen state.
250 class FullscreenTestBrowserWindow : public TestBrowserWindow, 250 class FullscreenTestBrowserWindow : public TestBrowserWindow,
251 ExclusiveAccessContext { 251 ExclusiveAccessContext {
252 public: 252 public:
253 FullscreenTestBrowserWindow( 253 FullscreenTestBrowserWindow(
254 BrowserCommandControllerFullscreenTest* test_browser) 254 BrowserCommandControllerFullscreenTest* test_browser)
255 : fullscreen_(false), test_browser_(test_browser) {} 255 : fullscreen_(false),
256 toolbar_showing_(false),
257 test_browser_(test_browser) {}
256 258
257 ~FullscreenTestBrowserWindow() override {} 259 ~FullscreenTestBrowserWindow() override {}
258 260
259 // TestBrowserWindow overrides: 261 // TestBrowserWindow overrides:
260 bool ShouldHideUIForFullscreen() const override { return fullscreen_; } 262 bool ShouldHideUIForFullscreen() const override { return fullscreen_; }
261 bool IsFullscreen() const override { return fullscreen_; } 263 bool IsFullscreen() const override { return fullscreen_; }
262 void EnterFullscreen(const GURL& url, 264 void EnterFullscreen(const GURL& url,
263 ExclusiveAccessBubbleType type) override { 265 ExclusiveAccessBubbleType type) override {
264 fullscreen_ = true; 266 fullscreen_ = true;
265 } 267 }
266 void ExitFullscreen() override { fullscreen_ = false; } 268 void ExitFullscreen() override { fullscreen_ = false; }
269 bool IsToolbarShowing() const override { return toolbar_showing_; }
267 270
268 ExclusiveAccessContext* GetExclusiveAccessContext() override { return this; } 271 ExclusiveAccessContext* GetExclusiveAccessContext() override { return this; }
269 272
270 // Exclusive access interface: 273 // Exclusive access interface:
271 Profile* GetProfile() override; 274 Profile* GetProfile() override;
272 content::WebContents* GetActiveWebContents() override; 275 content::WebContents* GetActiveWebContents() override;
273 void HideDownloadShelf() override {} 276 void HideDownloadShelf() override {}
274 void UnhideDownloadShelf() override {} 277 void UnhideDownloadShelf() override {}
275 void UpdateExclusiveAccessExitBubbleContent( 278 void UpdateExclusiveAccessExitBubbleContent(
276 const GURL& url, 279 const GURL& url,
277 ExclusiveAccessBubbleType bubble_type) override {} 280 ExclusiveAccessBubbleType bubble_type) override {}
278 void OnExclusiveAccessUserInput() override {} 281 void OnExclusiveAccessUserInput() override {}
279 282
283 void set_toolbar_showing(bool showing) { toolbar_showing_ = showing; }
284
280 private: 285 private:
281 bool fullscreen_; 286 bool fullscreen_;
287 bool toolbar_showing_;
282 BrowserCommandControllerFullscreenTest* test_browser_; 288 BrowserCommandControllerFullscreenTest* test_browser_;
283 289
284 DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow); 290 DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow);
285 }; 291 };
286 292
287 // Test that uses FullscreenTestBrowserWindow for its window. 293 // Test that uses FullscreenTestBrowserWindow for its window.
288 class BrowserCommandControllerFullscreenTest 294 class BrowserCommandControllerFullscreenTest
289 : public BrowserWithTestWindowTest { 295 : public BrowserWithTestWindowTest {
290 public: 296 public:
291 BrowserCommandControllerFullscreenTest() {} 297 BrowserCommandControllerFullscreenTest() {}
(...skipping 13 matching lines...) Expand all
305 Profile* FullscreenTestBrowserWindow::GetProfile() { 311 Profile* FullscreenTestBrowserWindow::GetProfile() {
306 return test_browser_->GetBrowser()->profile(); 312 return test_browser_->GetBrowser()->profile();
307 } 313 }
308 314
309 content::WebContents* FullscreenTestBrowserWindow::GetActiveWebContents() { 315 content::WebContents* FullscreenTestBrowserWindow::GetActiveWebContents() {
310 return test_browser_->GetBrowser()->tab_strip_model()->GetActiveWebContents(); 316 return test_browser_->GetBrowser()->tab_strip_model()->GetActiveWebContents();
311 } 317 }
312 318
313 TEST_F(BrowserCommandControllerFullscreenTest, 319 TEST_F(BrowserCommandControllerFullscreenTest,
314 UpdateCommandsForFullscreenMode) { 320 UpdateCommandsForFullscreenMode) {
321 struct {
322 int command_id;
323 // Whether the command is enabled in tab mode.
324 bool enabled_in_tab;
325 // Whether the keyboard shortcut is reserved in tab mode.
326 bool reserved_in_tab;
327 // Whether the command is enabled in fullscreen mode.
328 bool enabled_in_fullscreen;
329 // Whether the keyboard shortcut is reserved in fullscreen mode.
330 bool reserved_in_fullscreen;
331 } commands[] = {
332 // 1. Most commands are disabled in fullscreen.
333 // 2. In fullscreen, only the exit fullscreen commands are reserved. All
334 // other shortcuts should be delivered to the web page. See
335 // http://crbug.com/680809.
336
337 // Command ID | tab mode | fullscreen |
338 // | enabled | reserved | enabled | reserved |
339 { IDC_OPEN_CURRENT_URL, true, false, false, false },
340 { IDC_FOCUS_TOOLBAR, true, false, false, false },
341 { IDC_FOCUS_LOCATION, true, false, false, false },
342 { IDC_FOCUS_SEARCH, true, false, false, false },
343 { IDC_FOCUS_MENU_BAR, true, false, false, false },
344 { IDC_FOCUS_NEXT_PANE, true, false, false, false },
345 { IDC_FOCUS_PREVIOUS_PANE, true, false, false, false },
346 { IDC_FOCUS_BOOKMARKS, true, false, false, false },
347 { IDC_DEVELOPER_MENU, true, false, false, false },
348 #if defined(GOOGLE_CHROME_BUILD)
349 { IDC_FEEDBACK, true, false, false, false },
350 #endif
351 { IDC_OPTIONS, true, false, false, false },
352 { IDC_IMPORT_SETTINGS, true, false, false, false },
353 { IDC_EDIT_SEARCH_ENGINES, true, false, false, false },
354 { IDC_VIEW_PASSWORDS, true, false, false, false },
355 { IDC_ABOUT, true, false, false, false },
356 { IDC_SHOW_APP_MENU, true, false, false, false },
357 { IDC_FULLSCREEN, true, false, true, true },
358 { IDC_CLOSE_TAB, true, true, true, false },
359 { IDC_CLOSE_WINDOW, true, true, true, false },
360 { IDC_NEW_INCOGNITO_WINDOW, true, true, true, false },
361 { IDC_NEW_TAB, true, true, true, false },
362 { IDC_NEW_WINDOW, true, true, true, false },
363 { IDC_SELECT_NEXT_TAB, true, true, true, false },
364 { IDC_SELECT_PREVIOUS_TAB, true, true, true, false },
365 { IDC_EXIT, true, true, true, true },
366 { IDC_SHOW_AS_TAB, false, false, false, false },
367 };
368 const content::NativeWebKeyboardEvent key_event(
369 blink::WebInputEvent::TypeFirst, 0, 0);
315 // Defaults for a tabbed browser. 370 // Defaults for a tabbed browser.
316 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); 371 for (size_t i = 0; i < arraysize(commands); i++) {
317 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB)); 372 SCOPED_TRACE(testing::Message()
msw 2017/04/06 03:03:48 nit: add SCOPED_TRACE messages for the other loops
Hzj_jie 2017/04/06 18:34:24 Oh, sorry, seems I have not copied these lines to
318 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR)); 373 << std::endl
319 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); 374 << "command = " << commands[i].command_id
320 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH)); 375 << " at " << i << std::endl);
321 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR)); 376 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id),
322 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE)); 377 commands[i].enabled_in_tab);
323 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE)); 378 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey(
324 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS)); 379 commands[i].command_id, key_event),
325 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU)); 380 commands[i].reserved_in_tab);
326 #if defined(GOOGLE_CHROME_BUILD) 381 }
327 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK));
328 #endif
329 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
330 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS));
331 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES));
332 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS));
333 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT));
334 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU));
335 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
336 382
337 // Simulate going fullscreen. 383 // Simulate going fullscreen.
338 chrome::ToggleFullscreenMode(browser()); 384 chrome::ToggleFullscreenMode(browser());
339 ASSERT_TRUE(browser()->window()->IsFullscreen()); 385 ASSERT_TRUE(browser()->window()->IsFullscreen());
340 browser()->command_controller()->FullscreenStateChanged(); 386 browser()->command_controller()->FullscreenStateChanged();
341 387
342 // Most commands are disabled in fullscreen. 388 #if defined(OS_MACOSX)
msw 2017/04/06 03:03:48 nit: skip |#if defined(OS_MACOSX)|, and just do th
Hzj_jie 2017/04/06 18:34:24 Done. Since this EXPECT_FALSE expects the IsToolba
343 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); 389 // When the toolbar is not showing, the behavior on Mac OS should be
344 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB)); 390 // consistent with other platforms.
345 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR)); 391 static_cast<FullscreenTestBrowserWindow*>(window())->set_toolbar_showing(
346 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); 392 false);
347 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH));
348 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR));
349 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE));
350 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE));
351 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS));
352 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU));
353 #if defined(GOOGLE_CHROME_BUILD)
354 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK));
355 #endif 393 #endif
356 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); 394 for (size_t i = 0; i < arraysize(commands); i++) {
357 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); 395 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id),
358 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES)); 396 commands[i].enabled_in_fullscreen);
359 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS)); 397 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey(
360 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ABOUT)); 398 commands[i].command_id, key_event),
361 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU)); 399 commands[i].reserved_in_fullscreen);
362 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 400 }
363 401
402 #if defined(OS_MACOSX)
403 // When the toolbar is showing, commands should be reserved as if the content
404 // were in a tab; IDC_FULLSCREEN should also be reserved.
405 static_cast<FullscreenTestBrowserWindow*>(window())->set_toolbar_showing(
406 true);
364 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 407 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
365 IDC_CLOSE_TAB, 408 IDC_FULLSCREEN, key_event));
366 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 409 for (size_t i = 0; i < arraysize(commands); i++) {
367 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 410 if (commands[i].command_id != IDC_FULLSCREEN) {
368 IDC_CLOSE_WINDOW, 411 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey(
369 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 412 commands[i].command_id, key_event),
370 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 413 commands[i].reserved_in_tab);
371 IDC_NEW_INCOGNITO_WINDOW, 414 }
372 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 415 }
373 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 416 // Return to default state.
374 IDC_NEW_TAB, 417 static_cast<FullscreenTestBrowserWindow*>(window())->set_toolbar_showing(
375 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 418 false);
376 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 419 #endif
377 IDC_NEW_WINDOW,
378 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
379 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
380 IDC_SELECT_NEXT_TAB,
381 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
382 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
383 IDC_SELECT_PREVIOUS_TAB,
384 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
385 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
386 IDC_EXIT,
387 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
388 420
389 // Exit fullscreen. 421 // Exit fullscreen.
390 chrome::ToggleFullscreenMode(browser()); 422 chrome::ToggleFullscreenMode(browser());
391 ASSERT_FALSE(browser()->window()->IsFullscreen()); 423 ASSERT_FALSE(browser()->window()->IsFullscreen());
392 browser()->command_controller()->FullscreenStateChanged(); 424 browser()->command_controller()->FullscreenStateChanged();
393 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL));
394 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB));
395 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR));
396 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION));
397 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH));
398 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR));
399 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE));
400 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE));
401 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS));
402 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU));
403 #if defined(GOOGLE_CHROME_BUILD)
404 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK));
405 #endif
406 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
407 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS));
408 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES));
409 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS));
410 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT));
411 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU));
412 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
413 425
414 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 426 for (size_t i = 0; i < arraysize(commands); i++) {
415 IDC_CLOSE_TAB, 427 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id),
416 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 428 commands[i].enabled_in_tab);
417 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 429 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey(
418 IDC_CLOSE_WINDOW, 430 commands[i].command_id, key_event),
419 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); 431 commands[i].reserved_in_tab);
420 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( 432 }
421 IDC_NEW_INCOGNITO_WINDOW,
422 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
423 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
424 IDC_NEW_TAB,
425 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
426 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
427 IDC_NEW_WINDOW,
428 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
429 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
430 IDC_SELECT_NEXT_TAB,
431 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
432 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
433 IDC_SELECT_PREVIOUS_TAB,
434 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
435 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
436 IDC_EXIT,
437 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
438 433
439 // Guest Profiles disallow some options. 434 // Guest Profiles disallow some options.
440 TestingProfile* testprofile = browser()->profile()->AsTestingProfile(); 435 TestingProfile* testprofile = browser()->profile()->AsTestingProfile();
441 EXPECT_TRUE(testprofile); 436 EXPECT_TRUE(testprofile);
442 testprofile->SetGuestSession(true); 437 testprofile->SetGuestSession(true);
443 438
444 browser()->command_controller()->FullscreenStateChanged(); 439 browser()->command_controller()->FullscreenStateChanged();
445 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); 440 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
446 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); 441 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS));
447 } 442 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 491
497 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { 492 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) {
498 chrome::BrowserCommandController command_controller(browser()); 493 chrome::BrowserCommandController command_controller(browser());
499 const CommandUpdater* command_updater = command_controller.command_updater(); 494 const CommandUpdater* command_updater = command_controller.command_updater();
500 495
501 // Check that the SYNC_SETUP command is updated on preference change. 496 // Check that the SYNC_SETUP command is updated on preference change.
502 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 497 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
503 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 498 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
504 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); 499 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP));
505 } 500 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698