OLD | NEW |
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 Loading... |
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 Loading... |
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(commands[i].command_id); |
318 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR)); | 373 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id), |
319 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); | 374 commands[i].enabled_in_tab); |
320 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH)); | 375 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey( |
321 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR)); | 376 commands[i].command_id, key_event), |
322 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE)); | 377 commands[i].reserved_in_tab); |
323 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE)); | 378 } |
324 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS)); | |
325 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU)); | |
326 #if defined(GOOGLE_CHROME_BUILD) | |
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 | 379 |
337 // Simulate going fullscreen. | 380 // Simulate going fullscreen. |
338 chrome::ToggleFullscreenMode(browser()); | 381 chrome::ToggleFullscreenMode(browser()); |
339 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 382 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
340 browser()->command_controller()->FullscreenStateChanged(); | 383 browser()->command_controller()->FullscreenStateChanged(); |
341 | 384 |
342 // Most commands are disabled in fullscreen. | 385 // By default, in fullscreen mode, the toolbar should be hidden; and all |
343 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); | 386 // platforms behave similarly. |
344 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_AS_TAB)); | 387 EXPECT_FALSE(window()->IsToolbarShowing()); |
345 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_TOOLBAR)); | 388 for (size_t i = 0; i < arraysize(commands); i++) { |
346 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); | 389 SCOPED_TRACE(commands[i].command_id); |
347 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_SEARCH)); | 390 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id), |
348 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_MENU_BAR)); | 391 commands[i].enabled_in_fullscreen); |
349 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_NEXT_PANE)); | 392 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey( |
350 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_PREVIOUS_PANE)); | 393 commands[i].command_id, key_event), |
351 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_BOOKMARKS)); | 394 commands[i].reserved_in_fullscreen); |
352 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_DEVELOPER_MENU)); | 395 } |
353 #if defined(GOOGLE_CHROME_BUILD) | 396 |
354 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FEEDBACK)); | 397 #if defined(OS_MACOSX) |
| 398 // When the toolbar is showing, commands should be reserved as if the content |
| 399 // were in a tab; IDC_FULLSCREEN should also be reserved. |
| 400 static_cast<FullscreenTestBrowserWindow*>(window())->set_toolbar_showing( |
| 401 true); |
| 402 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( |
| 403 IDC_FULLSCREEN, key_event)); |
| 404 for (size_t i = 0; i < arraysize(commands); i++) { |
| 405 if (commands[i].command_id != IDC_FULLSCREEN) { |
| 406 SCOPED_TRACE(commands[i].command_id); |
| 407 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey( |
| 408 commands[i].command_id, key_event), |
| 409 commands[i].reserved_in_tab); |
| 410 } |
| 411 } |
| 412 // Return to default state. |
| 413 static_cast<FullscreenTestBrowserWindow*>(window())->set_toolbar_showing( |
| 414 false); |
355 #endif | 415 #endif |
356 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); | |
357 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); | |
358 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_EDIT_SEARCH_ENGINES)); | |
359 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS)); | |
360 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ABOUT)); | |
361 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU)); | |
362 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); | |
363 | |
364 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | |
365 IDC_CLOSE_TAB, | |
366 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | |
367 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | |
368 IDC_CLOSE_WINDOW, | |
369 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | |
370 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | |
371 IDC_NEW_INCOGNITO_WINDOW, | |
372 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | |
373 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | |
374 IDC_NEW_TAB, | |
375 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | |
376 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | |
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 | 416 |
389 // Exit fullscreen. | 417 // Exit fullscreen. |
390 chrome::ToggleFullscreenMode(browser()); | 418 chrome::ToggleFullscreenMode(browser()); |
391 ASSERT_FALSE(browser()->window()->IsFullscreen()); | 419 ASSERT_FALSE(browser()->window()->IsFullscreen()); |
392 browser()->command_controller()->FullscreenStateChanged(); | 420 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 | 421 |
414 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | 422 for (size_t i = 0; i < arraysize(commands); i++) { |
415 IDC_CLOSE_TAB, | 423 SCOPED_TRACE(commands[i].command_id); |
416 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | 424 EXPECT_EQ(chrome::IsCommandEnabled(browser(), commands[i].command_id), |
417 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | 425 commands[i].enabled_in_tab); |
418 IDC_CLOSE_WINDOW, | 426 EXPECT_EQ(browser()->command_controller()->IsReservedCommandOrKey( |
419 content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0))); | 427 commands[i].command_id, key_event), |
420 EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey( | 428 commands[i].reserved_in_tab); |
421 IDC_NEW_INCOGNITO_WINDOW, | 429 } |
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 | 430 |
439 // Guest Profiles disallow some options. | 431 // Guest Profiles disallow some options. |
440 TestingProfile* testprofile = browser()->profile()->AsTestingProfile(); | 432 TestingProfile* testprofile = browser()->profile()->AsTestingProfile(); |
441 EXPECT_TRUE(testprofile); | 433 EXPECT_TRUE(testprofile); |
442 testprofile->SetGuestSession(true); | 434 testprofile->SetGuestSession(true); |
443 | 435 |
444 browser()->command_controller()->FullscreenStateChanged(); | 436 browser()->command_controller()->FullscreenStateChanged(); |
445 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); | 437 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS)); |
446 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); | 438 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_IMPORT_SETTINGS)); |
447 } | 439 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 488 |
497 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { | 489 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { |
498 chrome::BrowserCommandController command_controller(browser()); | 490 chrome::BrowserCommandController command_controller(browser()); |
499 const CommandUpdater* command_updater = command_controller.command_updater(); | 491 const CommandUpdater* command_updater = command_controller.command_updater(); |
500 | 492 |
501 // Check that the SYNC_SETUP command is updated on preference change. | 493 // Check that the SYNC_SETUP command is updated on preference change. |
502 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 494 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
503 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 495 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
504 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 496 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
505 } | 497 } |
OLD | NEW |