| 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 "ash/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_table.h" | 7 #include "ash/common/accelerators/accelerator_table.h" |
| 8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
| 9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
| 10 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/ime_control_delegate.h" | 11 #include "ash/common/ime_control_delegate.h" |
| 11 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/system/brightness_control_delegate.h" | 13 #include "ash/common/system/brightness_control_delegate.h" |
| 13 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 14 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
| 14 #include "ash/common/system/tray/system_tray_delegate.h" | 15 #include "ash/common/system/tray/system_tray_delegate.h" |
| 15 #include "ash/common/test/ash_test.h" | 16 #include "ash/common/test/ash_test.h" |
| 16 #include "ash/common/wm/panels/panel_layout_manager.h" | 17 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 17 #include "ash/common/wm/window_positioning_utils.h" | 18 #include "ash/common/wm/window_positioning_utils.h" |
| 18 #include "ash/common/wm/window_state.h" | 19 #include "ash/common/wm/window_state.h" |
| 19 #include "ash/common/wm/wm_event.h" | 20 #include "ash/common/wm/wm_event.h" |
| 20 #include "ash/common/wm_lookup.h" | 21 #include "ash/common/wm_lookup.h" |
| 21 #include "ash/common/wm_root_window_controller.h" | 22 #include "ash/common/wm_root_window_controller.h" |
| 22 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
| 23 #include "ash/mus/accelerators/accelerator_controller_registrar_test_api.h" | 24 #include "ash/mus/accelerators/accelerator_controller_registrar_test_api.h" |
| 24 #include "ash/mus/bridge/wm_shell_mus_test_api.h" | 25 #include "ash/mus/bridge/wm_shell_mus_test_api.h" |
| 25 #include "ash/mus/bridge/wm_window_mus.h" | 26 #include "ash/mus/bridge/wm_window_mus.h" |
| 26 #include "ash/mus/property_util.h" | 27 #include "ash/mus/property_util.h" |
| 27 #include "ash/mus/test/wm_test_base.h" | 28 #include "ash/mus/test/wm_test_base.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 29 #include "ash/public/cpp/shell_window_ids.h" |
| 30 #include "base/command_line.h" |
| 29 #include "base/test/user_action_tester.cc" | 31 #include "base/test/user_action_tester.cc" |
| 30 #include "services/ui/public/interfaces/window_manager.mojom.h" | 32 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 31 #include "ui/aura/client/aura_constants.h" | 33 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
| 33 #include "ui/events/event.h" | 35 #include "ui/events/event.h" |
| 34 #include "ui/events/event_processor.h" | 36 #include "ui/events/event_processor.h" |
| 35 #include "ui/events/test/event_generator.h" | 37 #include "ui/events/test/event_generator.h" |
| 36 #include "ui/message_center/message_center.h" | 38 #include "ui/message_center/message_center.h" |
| 37 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 38 | 40 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 EXPECT_TRUE(window_state->IsMinimized()); | 480 EXPECT_TRUE(window_state->IsMinimized()); |
| 479 window_state->Restore(); | 481 window_state->Restore(); |
| 480 window_state->Activate(); | 482 window_state->Activate(); |
| 481 } | 483 } |
| 482 { | 484 { |
| 483 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE); | 485 GetController()->PerformActionIfEnabled(WINDOW_MINIMIZE); |
| 484 EXPECT_TRUE(window_state->IsMinimized()); | 486 EXPECT_TRUE(window_state->IsMinimized()); |
| 485 } | 487 } |
| 486 } | 488 } |
| 487 | 489 |
| 488 TEST_F(AcceleratorControllerTest, WindowSnapLeftDockLeftRestore) { | 490 // Tests that when window docking is disabled, only snapping windows works. |
| 491 TEST_F(AcceleratorControllerTest, WindowSnapWithoutDocking) { |
| 492 ASSERT_FALSE(ash::switches::DockedWindowsEnabled()); |
| 493 WmWindow* window = |
| 494 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 495 wm::WindowState* window_state = window->GetWindowState(); |
| 496 window_state->Activate(); |
| 497 |
| 498 // Snap right. |
| 499 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 500 gfx::Rect normal_bounds = window_state->GetRestoreBoundsInParent(); |
| 501 gfx::Rect expected_bounds = |
| 502 wm::GetDefaultRightSnappedWindowBoundsInParent(window); |
| 503 EXPECT_EQ(expected_bounds.ToString(), window->GetBounds().ToString()); |
| 504 EXPECT_TRUE(window_state->IsSnapped()); |
| 505 // Snap right again ->> becomes normal. |
| 506 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 507 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 508 EXPECT_FALSE(window_state->IsDocked()); |
| 509 EXPECT_EQ(normal_bounds.ToString(), window->GetBounds().ToString()); |
| 510 // Snap right. |
| 511 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 512 EXPECT_TRUE(window_state->IsSnapped()); |
| 513 EXPECT_FALSE(window_state->IsDocked()); |
| 514 // Snap left. |
| 515 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 516 EXPECT_TRUE(window_state->IsSnapped()); |
| 517 EXPECT_FALSE(window_state->IsDocked()); |
| 518 expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent(window); |
| 519 EXPECT_EQ(expected_bounds.ToString(), window->GetBounds().ToString()); |
| 520 // Snap left again ->> becomes normal. |
| 521 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 522 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 523 EXPECT_FALSE(window_state->IsDocked()); |
| 524 EXPECT_EQ(normal_bounds.ToString(), window->GetBounds().ToString()); |
| 525 } |
| 526 |
| 527 // Test class used for testing docked windows. |
| 528 class EnabledDockedWindowsAcceleratorControllerTest |
| 529 : public AcceleratorControllerTest { |
| 530 public: |
| 531 EnabledDockedWindowsAcceleratorControllerTest() = default; |
| 532 ~EnabledDockedWindowsAcceleratorControllerTest() override = default; |
| 533 |
| 534 void SetUp() override { |
| 535 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 536 ash::switches::kAshEnableDockedWindows); |
| 537 AcceleratorControllerTest::SetUp(); |
| 538 } |
| 539 |
| 540 private: |
| 541 DISALLOW_COPY_AND_ASSIGN(EnabledDockedWindowsAcceleratorControllerTest); |
| 542 }; |
| 543 |
| 544 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |
| 545 WindowSnapLeftDockLeftRestore) { |
| 489 CreateTestWindow(gfx::Rect(5, 5, 20, 20)); | 546 CreateTestWindow(gfx::Rect(5, 5, 20, 20)); |
| 490 WmWindow* window1 = | 547 WmWindow* window1 = |
| 491 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); | 548 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 492 wm::WindowState* window1_state = window1->GetWindowState(); | 549 wm::WindowState* window1_state = window1->GetWindowState(); |
| 493 window1_state->Activate(); | 550 window1_state->Activate(); |
| 494 | 551 |
| 495 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 552 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 496 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); | 553 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); |
| 497 gfx::Rect expected_bounds = | 554 gfx::Rect expected_bounds = |
| 498 wm::GetDefaultLeftSnappedWindowBoundsInParent(window1); | 555 wm::GetDefaultLeftSnappedWindowBoundsInParent(window1); |
| 499 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); | 556 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); |
| 500 EXPECT_TRUE(window1_state->IsSnapped()); | 557 EXPECT_TRUE(window1_state->IsSnapped()); |
| 501 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 558 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 502 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 559 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |
| 503 EXPECT_TRUE(window1_state->IsDocked()); | 560 EXPECT_TRUE(window1_state->IsDocked()); |
| 504 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 561 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 505 EXPECT_FALSE(window1_state->IsDocked()); | 562 EXPECT_FALSE(window1_state->IsDocked()); |
| 506 EXPECT_EQ(normal_bounds.ToString(), window1->GetBounds().ToString()); | 563 EXPECT_EQ(normal_bounds.ToString(), window1->GetBounds().ToString()); |
| 507 } | 564 } |
| 508 | 565 |
| 509 TEST_F(AcceleratorControllerTest, WindowSnapRightDockRightRestore) { | 566 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |
| 567 WindowSnapRightDockRightRestore) { |
| 510 CreateTestWindow(gfx::Rect(5, 5, 20, 20)); | 568 CreateTestWindow(gfx::Rect(5, 5, 20, 20)); |
| 511 WmWindow* window1 = | 569 WmWindow* window1 = |
| 512 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); | 570 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 513 | 571 |
| 514 wm::WindowState* window1_state = window1->GetWindowState(); | 572 wm::WindowState* window1_state = window1->GetWindowState(); |
| 515 window1_state->Activate(); | 573 window1_state->Activate(); |
| 516 | 574 |
| 517 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 575 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 518 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); | 576 gfx::Rect normal_bounds = window1_state->GetRestoreBoundsInParent(); |
| 519 gfx::Rect expected_bounds = | 577 gfx::Rect expected_bounds = |
| 520 wm::GetDefaultRightSnappedWindowBoundsInParent(window1); | 578 wm::GetDefaultRightSnappedWindowBoundsInParent(window1); |
| 521 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); | 579 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); |
| 522 EXPECT_TRUE(window1_state->IsSnapped()); | 580 EXPECT_TRUE(window1_state->IsSnapped()); |
| 523 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 581 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 524 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 582 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |
| 525 EXPECT_TRUE(window1_state->IsDocked()); | 583 EXPECT_TRUE(window1_state->IsDocked()); |
| 526 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 584 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 527 EXPECT_FALSE(window1_state->IsDocked()); | 585 EXPECT_FALSE(window1_state->IsDocked()); |
| 528 EXPECT_EQ(normal_bounds.ToString(), window1->GetBounds().ToString()); | 586 EXPECT_EQ(normal_bounds.ToString(), window1->GetBounds().ToString()); |
| 529 } | 587 } |
| 530 | 588 |
| 531 TEST_F(AcceleratorControllerTest, WindowSnapLeftDockLeftSnapRight) { | 589 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |
| 590 WindowSnapLeftDockLeftSnapRight) { |
| 532 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); | 591 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 533 WmWindow* window1 = | 592 WmWindow* window1 = |
| 534 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); | 593 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 535 | 594 |
| 536 wm::WindowState* window1_state = window1->GetWindowState(); | 595 wm::WindowState* window1_state = window1->GetWindowState(); |
| 537 window1_state->Activate(); | 596 window1_state->Activate(); |
| 538 | 597 |
| 539 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 598 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 540 gfx::Rect expected_bounds = | 599 gfx::Rect expected_bounds = |
| 541 wm::GetDefaultLeftSnappedWindowBoundsInParent(window1); | 600 wm::GetDefaultLeftSnappedWindowBoundsInParent(window1); |
| 542 gfx::Rect expected_bounds2 = | 601 gfx::Rect expected_bounds2 = |
| 543 wm::GetDefaultRightSnappedWindowBoundsInParent(window1); | 602 wm::GetDefaultRightSnappedWindowBoundsInParent(window1); |
| 544 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); | 603 EXPECT_EQ(expected_bounds.ToString(), window1->GetBounds().ToString()); |
| 545 EXPECT_TRUE(window1_state->IsSnapped()); | 604 EXPECT_TRUE(window1_state->IsSnapped()); |
| 546 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 605 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 547 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); | 606 EXPECT_FALSE(window1_state->IsNormalOrSnapped()); |
| 548 EXPECT_TRUE(window1_state->IsDocked()); | 607 EXPECT_TRUE(window1_state->IsDocked()); |
| 549 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 608 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 550 EXPECT_FALSE(window1_state->IsDocked()); | 609 EXPECT_FALSE(window1_state->IsDocked()); |
| 551 EXPECT_TRUE(window1_state->IsSnapped()); | 610 EXPECT_TRUE(window1_state->IsSnapped()); |
| 552 EXPECT_EQ(expected_bounds2.ToString(), window1->GetBounds().ToString()); | 611 EXPECT_EQ(expected_bounds2.ToString(), window1->GetBounds().ToString()); |
| 553 } | 612 } |
| 554 | 613 |
| 555 TEST_F(AcceleratorControllerTest, WindowDockLeftMinimizeWindowWithRestore) { | 614 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |
| 615 WindowDockLeftMinimizeWindowWithRestore) { |
| 556 WindowOwner window_owner( | 616 WindowOwner window_owner( |
| 557 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); | 617 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); |
| 558 WindowOwner window1_owner( | 618 WindowOwner window1_owner( |
| 559 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); | 619 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); |
| 560 WmWindow* window1 = window1_owner.window(); | 620 WmWindow* window1 = window1_owner.window(); |
| 561 | 621 |
| 562 wm::WindowState* window1_state = window1->GetWindowState(); | 622 wm::WindowState* window1_state = window1->GetWindowState(); |
| 563 window1_state->Activate(); | 623 window1_state->Activate(); |
| 564 | 624 |
| 565 WindowOwner window2_owner( | 625 WindowOwner window2_owner( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 657 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 598 window3_state->Unminimize(); | 658 window3_state->Unminimize(); |
| 599 EXPECT_FALSE(window1_state->IsDocked()); | 659 EXPECT_FALSE(window1_state->IsDocked()); |
| 600 EXPECT_FALSE(window2_state->IsDocked()); | 660 EXPECT_FALSE(window2_state->IsDocked()); |
| 601 EXPECT_TRUE(window3_state->IsDocked()); | 661 EXPECT_TRUE(window3_state->IsDocked()); |
| 602 EXPECT_EQ(window3_docked_bounds.ToString(), window3->GetBounds().ToString()); | 662 EXPECT_EQ(window3_docked_bounds.ToString(), window3->GetBounds().ToString()); |
| 603 } | 663 } |
| 604 | 664 |
| 605 // TODO: Needs CreatePanel(): http://crbug.com/632209. | 665 // TODO: Needs CreatePanel(): http://crbug.com/632209. |
| 606 /* | 666 /* |
| 607 TEST_F(AcceleratorControllerTest, WindowPanelDockLeftDockRightRestore) { | 667 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, |
| 668 WindowPanelDockLeftDockRightRestore) { |
| 608 WmWndow* window0 = | 669 WmWndow* window0 = |
| 609 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); | 670 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20))); |
| 610 | 671 |
| 611 std::unique_ptr<aura::Window> window(CreatePanel()); | 672 std::unique_ptr<aura::Window> window(CreatePanel()); |
| 612 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 673 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 613 window_state->Activate(); | 674 window_state->Activate(); |
| 614 | 675 |
| 615 gfx::Rect window_restore_bounds2 = window->bounds(); | 676 gfx::Rect window_restore_bounds2 = window->bounds(); |
| 616 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); | 677 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_LEFT); |
| 617 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( | 678 gfx::Rect expected_bounds = wm::GetDefaultLeftSnappedWindowBoundsInParent( |
| 618 WmWindowAura::Get(window.get())); | 679 WmWindowAura::Get(window.get())); |
| 619 gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen(); | 680 gfx::Rect window_restore_bounds = window_state->GetRestoreBoundsInScreen(); |
| 620 EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString()); | 681 EXPECT_NE(expected_bounds.ToString(), window->bounds().ToString()); |
| 621 EXPECT_FALSE(window_state->IsSnapped()); | 682 EXPECT_FALSE(window_state->IsSnapped()); |
| 622 EXPECT_FALSE(window_state->IsNormalOrSnapped()); | 683 EXPECT_FALSE(window_state->IsNormalOrSnapped()); |
| 623 EXPECT_TRUE(window_state->IsDocked()); | 684 EXPECT_TRUE(window_state->IsDocked()); |
| 624 window_state->Restore(); | 685 window_state->Restore(); |
| 625 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 686 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 626 EXPECT_TRUE(window_state->IsDocked()); | 687 EXPECT_TRUE(window_state->IsDocked()); |
| 627 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); | 688 GetController()->PerformActionIfEnabled(WINDOW_CYCLE_SNAP_DOCK_RIGHT); |
| 628 EXPECT_FALSE(window_state->IsDocked()); | 689 EXPECT_FALSE(window_state->IsDocked()); |
| 629 EXPECT_EQ(window_restore_bounds.ToString(), | 690 EXPECT_EQ(window_restore_bounds.ToString(), |
| 630 window_restore_bounds2.ToString()); | 691 window_restore_bounds2.ToString()); |
| 631 EXPECT_EQ(window_restore_bounds.ToString(), window->bounds().ToString()); | 692 EXPECT_EQ(window_restore_bounds.ToString(), window->bounds().ToString()); |
| 632 } | 693 } |
| 633 */ | 694 */ |
| 634 | 695 |
| 635 TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { | 696 TEST_F(EnabledDockedWindowsAcceleratorControllerTest, CenterWindowAccelerator) { |
| 636 WindowOwner window_owner( | 697 WindowOwner window_owner( |
| 637 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); | 698 mus::WmWindowMus::Get(CreateTestWindow(gfx::Rect(5, 5, 20, 20)))); |
| 638 WmWindow* window = window_owner.window(); | 699 WmWindow* window = window_owner.window(); |
| 639 wm::WindowState* window_state = window->GetWindowState(); | 700 wm::WindowState* window_state = window->GetWindowState(); |
| 640 window_state->Activate(); | 701 window_state->Activate(); |
| 641 | 702 |
| 642 // Center the window using accelerator. | 703 // Center the window using accelerator. |
| 643 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); | 704 GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); |
| 644 gfx::Rect work_area = window->GetDisplayNearestWindow().work_area(); | 705 gfx::Rect work_area = window->GetDisplayNearestWindow().work_area(); |
| 645 gfx::Rect bounds = window->GetBoundsInScreen(); | 706 gfx::Rect bounds = window->GetBoundsInScreen(); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 EXPECT_TRUE(IsMessageCenterEmpty()); | 1465 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1405 | 1466 |
| 1406 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1467 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1407 // screen before we proceed testing the rest of accelerators. | 1468 // screen before we proceed testing the rest of accelerators. |
| 1408 ResetStateIfNeeded(); | 1469 ResetStateIfNeeded(); |
| 1409 } | 1470 } |
| 1410 } | 1471 } |
| 1411 #endif // defined(OS_CHROMEOS) | 1472 #endif // defined(OS_CHROMEOS) |
| 1412 | 1473 |
| 1413 } // namespace ash | 1474 } // namespace ash |
| OLD | NEW |