OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/ws/window_manager_state.h" | 5 #include "services/ui/ws/window_manager_state.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/test/test_simple_task_runner.h" | 12 #include "base/test/test_simple_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "services/service_manager/public/interfaces/connector.mojom.h" | 14 #include "services/service_manager/public/interfaces/connector.mojom.h" |
15 #include "services/ui/common/accelerator_util.h" | 15 #include "services/ui/common/accelerator_util.h" |
16 #include "services/ui/ws/accelerator.h" | 16 #include "services/ui/ws/accelerator.h" |
17 #include "services/ui/ws/display.h" | 17 #include "services/ui/ws/display.h" |
18 #include "services/ui/ws/display_manager.h" | 18 #include "services/ui/ws/display_manager.h" |
19 #include "services/ui/ws/platform_display.h" | 19 #include "services/ui/ws/platform_display.h" |
20 #include "services/ui/ws/test_change_tracker.h" | 20 #include "services/ui/ws/test_change_tracker.h" |
21 #include "services/ui/ws/test_server_window_delegate.h" | 21 #include "services/ui/ws/test_server_window_delegate.h" |
22 #include "services/ui/ws/test_utils.h" | 22 #include "services/ui/ws/test_utils.h" |
23 #include "services/ui/ws/window_manager_access_policy.h" | 23 #include "services/ui/ws/window_manager_access_policy.h" |
24 #include "services/ui/ws/window_manager_display_root.h" | 24 #include "services/ui/ws/window_manager_display_root.h" |
25 #include "services/ui/ws/window_manager_state.h" | 25 #include "services/ui/ws/window_manager_state.h" |
26 #include "services/ui/ws/window_server.h" | 26 #include "services/ui/ws/window_server.h" |
27 #include "services/ui/ws/window_tree.h" | 27 #include "services/ui/ws/window_tree.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 #include "ui/base/cursor/cursor.h" |
29 #include "ui/events/event.h" | 30 #include "ui/events/event.h" |
30 | 31 |
31 namespace ui { | 32 namespace ui { |
32 namespace ws { | 33 namespace ws { |
33 namespace test { | 34 namespace test { |
34 | 35 |
35 class WindowManagerStateTest : public testing::Test { | 36 class WindowManagerStateTest : public testing::Test { |
36 public: | 37 public: |
37 WindowManagerStateTest(); | 38 WindowManagerStateTest(); |
38 ~WindowManagerStateTest() override {} | 39 ~WindowManagerStateTest() override {} |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 ASSERT_EQ(1u, window_server()->display_manager()->displays().size()); | 643 ASSERT_EQ(1u, window_server()->display_manager()->displays().size()); |
643 Display* display = *(window_server()->display_manager()->displays().begin()); | 644 Display* display = *(window_server()->display_manager()->displays().begin()); |
644 DisplayTestApi display_test_api(display); | 645 DisplayTestApi display_test_api(display); |
645 const ClientWindowId child_window_id(11); | 646 const ClientWindowId child_window_id(11); |
646 window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); | 647 window_tree()->NewWindow(child_window_id, ServerWindow::Properties()); |
647 ServerWindow* child_window = | 648 ServerWindow* child_window = |
648 window_tree()->GetWindowByClientId(child_window_id); | 649 window_tree()->GetWindowByClientId(child_window_id); |
649 window_tree()->AddWindow(FirstRootId(window_tree()), child_window_id); | 650 window_tree()->AddWindow(FirstRootId(window_tree()), child_window_id); |
650 child_window->SetVisible(true); | 651 child_window->SetVisible(true); |
651 child_window->SetBounds(gfx::Rect(0, 0, 20, 20)); | 652 child_window->SetBounds(gfx::Rect(0, 0, 20, 20)); |
652 child_window->parent()->SetPredefinedCursor(ui::mojom::CursorType::kCopy); | 653 child_window->parent()->SetCursor(ui::CursorData(ui::CursorType::kCopy)); |
653 EXPECT_EQ(ui::mojom::CursorType::kCopy, display_test_api.last_cursor()); | 654 EXPECT_EQ(ui::CursorType::kCopy, |
| 655 display_test_api.last_cursor().cursor_type()); |
654 // Move the mouse outside the bounds of the child, so that the mouse is not | 656 // Move the mouse outside the bounds of the child, so that the mouse is not |
655 // over any valid windows. Cursor should change to POINTER. | 657 // over any valid windows. Cursor should change to POINTER. |
656 ui::PointerEvent move( | 658 ui::PointerEvent move( |
657 ui::ET_POINTER_MOVED, gfx::Point(25, 25), gfx::Point(25, 25), 0, 0, | 659 ui::ET_POINTER_MOVED, gfx::Point(25, 25), gfx::Point(25, 25), 0, 0, |
658 ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, 0), | 660 ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, 0), |
659 base::TimeTicks()); | 661 base::TimeTicks()); |
660 window_manager_state()->ProcessEvent(move, 0); | 662 window_manager_state()->ProcessEvent(move, 0); |
661 // The event isn't over a valid target, which should trigger resetting the | 663 // The event isn't over a valid target, which should trigger resetting the |
662 // cursor to POINTER. | 664 // cursor to POINTER. |
663 EXPECT_EQ(ui::mojom::CursorType::kPointer, display_test_api.last_cursor()); | 665 EXPECT_EQ(ui::CursorType::kPointer, |
| 666 display_test_api.last_cursor().cursor_type()); |
664 } | 667 } |
665 | 668 |
666 } // namespace test | 669 } // namespace test |
667 } // namespace ws | 670 } // namespace ws |
668 } // namespace ui | 671 } // namespace ui |
OLD | NEW |