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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 2617733002: Hide docked windows behind a flag (Closed)
Patch Set: Fix tests failed because of DCHECK Created 3 years, 11 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 | « no previous file | ash/common/ash_switches.h » ('j') | ash/common/ash_switches.h » ('J')
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 "ash/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/accelerators/accelerator_table.h" 8 #include "ash/common/accelerators/accelerator_table.h"
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
11 #include "ash/common/ash_switches.h"
11 #include "ash/common/ime_control_delegate.h" 12 #include "ash/common/ime_control_delegate.h"
12 #include "ash/common/session/session_state_delegate.h" 13 #include "ash/common/session/session_state_delegate.h"
13 #include "ash/common/system/brightness_control_delegate.h" 14 #include "ash/common/system/brightness_control_delegate.h"
14 #include "ash/common/system/keyboard_brightness_control_delegate.h" 15 #include "ash/common/system/keyboard_brightness_control_delegate.h"
15 #include "ash/common/system/tray/system_tray_delegate.h" 16 #include "ash/common/system/tray/system_tray_delegate.h"
16 #include "ash/common/test/test_shelf_delegate.h" 17 #include "ash/common/test/test_shelf_delegate.h"
17 #include "ash/common/wm/panels/panel_layout_manager.h" 18 #include "ash/common/wm/panels/panel_layout_manager.h"
18 #include "ash/common/wm/window_positioning_utils.h" 19 #include "ash/common/wm/window_positioning_utils.h"
19 #include "ash/common/wm/window_state.h" 20 #include "ash/common/wm/window_state.h"
20 #include "ash/common/wm/wm_event.h" 21 #include "ash/common/wm/wm_event.h"
21 #include "ash/common/wm_shell.h" 22 #include "ash/common/wm_shell.h"
22 #include "ash/public/cpp/shell_window_ids.h" 23 #include "ash/public/cpp/shell_window_ids.h"
23 #include "ash/shell.h" 24 #include "ash/shell.h"
24 #include "ash/test/ash_test_base.h" 25 #include "ash/test/ash_test_base.h"
25 #include "ash/test/lock_state_controller_test_api.h" 26 #include "ash/test/lock_state_controller_test_api.h"
26 #include "ash/test/test_screenshot_delegate.h" 27 #include "ash/test/test_screenshot_delegate.h"
27 #include "ash/test/test_session_state_animator.h" 28 #include "ash/test/test_session_state_animator.h"
28 #include "ash/wm/lock_state_controller.h" 29 #include "ash/wm/lock_state_controller.h"
29 #include "ash/wm/window_state_aura.h" 30 #include "ash/wm/window_state_aura.h"
30 #include "ash/wm/window_util.h" 31 #include "ash/wm/window_util.h"
32 #include "base/command_line.h"
31 #include "base/test/user_action_tester.cc" 33 #include "base/test/user_action_tester.cc"
32 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 34 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
33 #include "ui/app_list/presenter/app_list.h" 35 #include "ui/app_list/presenter/app_list.h"
34 #include "ui/app_list/presenter/test/test_app_list_presenter.h" 36 #include "ui/app_list/presenter/test/test_app_list_presenter.h"
35 #include "ui/aura/client/aura_constants.h" 37 #include "ui/aura/client/aura_constants.h"
36 #include "ui/aura/test/test_window_delegate.h" 38 #include "ui/aura/test/test_window_delegate.h"
37 #include "ui/aura/test/test_windows.h" 39 #include "ui/aura/test/test_windows.h"
38 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
39 #include "ui/display/manager/display_manager.h" 41 #include "ui/display/manager/display_manager.h"
40 #include "ui/display/screen.h" 42 #include "ui/display/screen.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 EXPECT_TRUE(window_state->IsMinimized()); 471 EXPECT_TRUE(window_state->IsMinimized());
470 window_state->Restore(); 472 window_state->Restore();
471 window_state->Activate(); 473 window_state->Activate();
472 } 474 }
473 { 475 {
474 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE); 476 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE);
475 EXPECT_TRUE(window_state->IsMinimized()); 477 EXPECT_TRUE(window_state->IsMinimized());
476 } 478 }
477 } 479 }
478 480
479 TEST_F(AcceleratorControllerTest, WindowSnapLeftDockLeftRestore) { 481 // Tests that when window docking is disabled, only snapping windows works.
482 TEST_F(AcceleratorControllerTest, WindowSnapWithoutDocking) {
483 ASSERT_FALSE(ash::switches::DockedWindowsEnabled());
484 std::unique_ptr<aura::Window> window(
485 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
486
487 wm::WindowState* window_state = wm::GetWindowState(window.get());
488 window_state->Activate();
489
490 // Snap right.
491 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
492 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent();
493 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent(
494 WmWindowAura::Get(window.get()));
495 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
496 EXPECT_TRUE(window_state->IsSnapped());
497 // Snap right again ->> becomes normal.
498 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
499 EXPECT_TRUE(window_state->IsNormalStateType());
500 EXPECT_FALSE(window_state->IsDocked());
501 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString());
502 // Snap right.
503 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
504 EXPECT_TRUE(window_state->IsSnapped());
505 EXPECT_FALSE(window_state->IsDocked());
506 // Snap left.
507 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
508 EXPECT_TRUE(window_state->IsSnapped());
509 EXPECT_FALSE(window_state->IsDocked());
510 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
511 WmWindowAura::Get(window.get()));
512 EXPECT_EQ(expected_bounds.ToString(), window->bounds().ToString());
513 // Snap left again ->> becomes normal.
514 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
515 EXPECT_TRUE(window_state->IsNormalStateType());
516 EXPECT_FALSE(window_state->IsDocked());
517 EXPECT_EQ(normal_bounds.ToString(), window->bounds().ToString());
518 }
519
520 // Test class used for testing docked windows.
521 class EnabledDockedWindowsAcceleratorControllerTest
522 : public AcceleratorControllerTest {
523 public:
524 EnabledDockedWindowsAcceleratorControllerTest() = default;
525 ~EnabledDockedWindowsAcceleratorControllerTest() override = default;
526
527 void SetUp() override {
528 base::CommandLine::ForCurrentProcess()->AppendSwitch(
529 ash::switches::kAshEnableDockedWindows);
530 AcceleratorControllerTest::SetUp();
531 }
532
533 private:
534 DISALLOW_COPY_AND_ASSIGN(EnabledDockedWindowsAcceleratorControllerTest);
535 };
536
537 TEST_F(EnabledDockedWindowsAcceleratorControllerTest,
538 WindowSnapLeftDockLeftRestore) {
480 std::unique_ptr<aura::Window> window0( 539 std::unique_ptr<aura::Window> window0(
481 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 540 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
482 std::unique_ptr<aura::Window> window1( 541 std::unique_ptr<aura::Window> window1(
483 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 542 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
484 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); 543 wm::WindowState* window1_state = wm::GetWindowState(window1.get());
485 window1_state->Activate(); 544 window1_state->Activate();
486 545
487 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 546 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
488 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); 547 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent();
489 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 548 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
490 WmWindowAura::Get(window1.get())); 549 WmWindowAura::Get(window1.get()));
491 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); 550 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString());
492 EXPECT_TRUE(window1_state->IsSnapped()); 551 EXPECT_TRUE(window1_state->IsSnapped());
493 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 552 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
494 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); 553 EXPECT_FALSE(window1_state->IsNormalOrSnapped());
495 EXPECT_TRUE(window1_state->IsDocked()); 554 EXPECT_TRUE(window1_state->IsDocked());
496 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 555 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
497 EXPECT_FALSE(window1_state->IsDocked()); 556 EXPECT_FALSE(window1_state->IsDocked());
498 EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); 557 EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString());
499 } 558 }
500 559
501 TEST_F(AcceleratorControllerTest, WindowSnapRightDockRightRestore) { 560 TEST_F(EnabledDockedWindowsAcceleratorControllerTest,
561 WindowSnapRightDockRightRestore) {
502 std::unique_ptr<aura::Window> window0( 562 std::unique_ptr<aura::Window> window0(
503 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 563 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
504 std::unique_ptr<aura::Window> window1( 564 std::unique_ptr<aura::Window> window1(
505 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 565 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
506 566
507 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); 567 wm::WindowState* window1_state = wm::GetWindowState(window1.get());
508 window1_state->Activate(); 568 window1_state->Activate();
509 569
510 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 570 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
511 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); 571 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent();
512 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent( 572 gfx::Rect expected_bounds = wm::GetDefaultRightSnappedWindowBoundsInParent(
513 WmWindowAura::Get(window1.get())); 573 WmWindowAura::Get(window1.get()));
514 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); 574 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString());
515 EXPECT_TRUE(window1_state->IsSnapped()); 575 EXPECT_TRUE(window1_state->IsSnapped());
516 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 576 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
517 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); 577 EXPECT_FALSE(window1_state->IsNormalOrSnapped());
518 EXPECT_TRUE(window1_state->IsDocked()); 578 EXPECT_TRUE(window1_state->IsDocked());
519 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 579 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
520 EXPECT_FALSE(window1_state->IsDocked()); 580 EXPECT_FALSE(window1_state->IsDocked());
521 EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString()); 581 EXPECT_EQ(normal_bounds.ToString(), window1->bounds().ToString());
522 } 582 }
523 583
524 TEST_F(AcceleratorControllerTest, WindowSnapLeftDockLeftSnapRight) { 584 TEST_F(EnabledDockedWindowsAcceleratorControllerTest,
585 WindowSnapLeftDockLeftSnapRight) {
525 std::unique_ptr<aura::Window> window0( 586 std::unique_ptr<aura::Window> window0(
526 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 587 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
527 std::unique_ptr<aura::Window> window1( 588 std::unique_ptr<aura::Window> window1(
528 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 589 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
529 590
530 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); 591 wm::WindowState* window1_state = wm::GetWindowState(window1.get());
531 window1_state->Activate(); 592 window1_state->Activate();
532 593
533 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 594 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
534 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 595 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
535 WmWindowAura::Get(window1.get())); 596 WmWindowAura::Get(window1.get()));
536 gfx::Rect expected_bounds2 = wm::GetDefaultRightSnappedWindowBoundsInParent( 597 gfx::Rect expected_bounds2 = wm::GetDefaultRightSnappedWindowBoundsInParent(
537 WmWindowAura::Get(window1.get())); 598 WmWindowAura::Get(window1.get()));
538 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString()); 599 EXPECT_EQ(expected_bounds.ToString(), window1->bounds().ToString());
539 EXPECT_TRUE(window1_state->IsSnapped()); 600 EXPECT_TRUE(window1_state->IsSnapped());
540 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 601 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
541 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); 602 EXPECT_FALSE(window1_state->IsNormalOrSnapped());
542 EXPECT_TRUE(window1_state->IsDocked()); 603 EXPECT_TRUE(window1_state->IsDocked());
543 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 604 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
544 EXPECT_FALSE(window1_state->IsDocked()); 605 EXPECT_FALSE(window1_state->IsDocked());
545 EXPECT_TRUE(window1_state->IsSnapped()); 606 EXPECT_TRUE(window1_state->IsSnapped());
546 EXPECT_EQ(expected_bounds2.ToString(), window1->bounds().ToString()); 607 EXPECT_EQ(expected_bounds2.ToString(), window1->bounds().ToString());
547 } 608 }
548 609
549 TEST_F(AcceleratorControllerTest, WindowDockLeftMinimizeWindowWithRestore) { 610 TEST_F(EnabledDockedWindowsAcceleratorControllerTest,
611 WindowDockLeftMinimizeWindowWithRestore) {
550 std::unique_ptr<aura::Window> window0( 612 std::unique_ptr<aura::Window> window0(
551 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 613 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
552 std::unique_ptr<aura::Window> window1( 614 std::unique_ptr<aura::Window> window1(
553 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 615 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
554 616
555 wm::WindowState* window1_state = wm::GetWindowState(window1.get()); 617 wm::WindowState* window1_state = wm::GetWindowState(window1.get());
556 window1_state->Activate(); 618 window1_state->Activate();
557 619
558 std::unique_ptr<aura::Window> window2( 620 std::unique_ptr<aura::Window> window2(
559 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 621 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
(...skipping 26 matching lines...) Expand all
586 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 648 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
587 window2_state->Activate(); 649 window2_state->Activate();
588 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 650 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
589 window3_state->Unminimize(); 651 window3_state->Unminimize();
590 EXPECT_FALSE(window1_state->IsDocked()); 652 EXPECT_FALSE(window1_state->IsDocked());
591 EXPECT_FALSE(window2_state->IsDocked()); 653 EXPECT_FALSE(window2_state->IsDocked());
592 EXPECT_TRUE(window3_state->IsDocked()); 654 EXPECT_TRUE(window3_state->IsDocked());
593 EXPECT_EQ(window3_docked_bounds.ToString(), window3->bounds().ToString()); 655 EXPECT_EQ(window3_docked_bounds.ToString(), window3->bounds().ToString());
594 } 656 }
595 657
596 TEST_F(AcceleratorControllerTest, WindowPanelDockLeftDockRightRestore) { 658 TEST_F(EnabledDockedWindowsAcceleratorControllerTest,
659 WindowPanelDockLeftDockRightRestore) {
597 std::unique_ptr<aura::Window> window0( 660 std::unique_ptr<aura::Window> window0(
598 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 661 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
599 662
600 std::unique_ptr<aura::Window> window(CreatePanel()); 663 std::unique_ptr<aura::Window> window(CreatePanel());
601 wm::WindowState* window_state = wm::GetWindowState(window.get()); 664 wm::WindowState* window_state = wm::GetWindowState(window.get());
602 window_state->Activate(); 665 window_state->Activate();
603 666
604 gfx::Rect window_restore_bounds2 = window->bounds(); 667 gfx::Rect window_restore_bounds2 = window->bounds();
605 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); 668 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT);
606 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( 669 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(
607 WmWindowAura::Get(window.get())); 670 WmWindowAura::Get(window.get()));
608 gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen(); 671 gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen();
609 EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString()); 672 EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString());
610 EXPECT_FALSE(window_state->IsSnapped()); 673 EXPECT_FALSE(window_state->IsSnapped());
611 EXPECT_FALSE(window_state->IsNormalOrSnapped()); 674 EXPECT_FALSE(window_state->IsNormalOrSnapped());
612 EXPECT_TRUE(window_state->IsDocked()); 675 EXPECT_TRUE(window_state->IsDocked());
613 window_state->Restore(); 676 window_state->Restore();
614 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 677 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
615 EXPECT_TRUE(window_state->IsDocked()); 678 EXPECT_TRUE(window_state->IsDocked());
616 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); 679 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT);
617 EXPECT_FALSE(window_state->IsDocked()); 680 EXPECT_FALSE(window_state->IsDocked());
618 EXPECT_EQ(window_restore_bounds.ToString(), 681 EXPECT_EQ(window_restore_bounds.ToString(),
619 window_restore_bounds2.ToString()); 682 window_restore_bounds2.ToString());
620 EXPECT_EQ(window_restore_bounds.ToString(), window->bounds().ToString()); 683 EXPECT_EQ(window_restore_bounds.ToString(), window->bounds().ToString());
621 } 684 }
622 685
623 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { 686 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, CenterWindowAccelerator) {
624 std::unique_ptr<aura::Window> window( 687 std::unique_ptr<aura::Window> window(
625 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 688 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
626 wm::WindowState* window_state = wm::GetWindowState(window.get()); 689 wm::WindowState* window_state = wm::GetWindowState(window.get());
627 window_state->Activate(); 690 window_state->Activate();
628 691
629 // Center the window using accelerator. 692 // Center the window using accelerator.
630 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); 693 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER);
631 gfx::Rect work_area = display::Screen::GetScreen() 694 gfx::Rect work_area = display::Screen::GetScreen()
632 ->GetDisplayNearestWindow(window.get()) 695 ->GetDisplayNearestWindow(window.get())
633 .work_area(); 696 .work_area();
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 // Expect no notifications from the new accelerators. 1436 // Expect no notifications from the new accelerators.
1374 EXPECT_TRUE(IsMessageCenterEmpty()); 1437 EXPECT_TRUE(IsMessageCenterEmpty());
1375 1438
1376 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1439 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1377 // screen before we proceed testing the rest of accelerators. 1440 // screen before we proceed testing the rest of accelerators.
1378 ResetStateIfNeeded(); 1441 ResetStateIfNeeded();
1379 } 1442 }
1380 } 1443 }
1381 1444
1382 } // namespace ash 1445 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/ash_switches.h » ('j') | ash/common/ash_switches.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698