| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 WindowServer* window_server() { return ws_test_helper_.window_server(); } | 43 WindowServer* window_server() { return ws_test_helper_.window_server(); } |
| 44 TestWindowServerDelegate* window_server_delegate() { | 44 TestWindowServerDelegate* window_server_delegate() { |
| 45 return ws_test_helper_.window_server_delegate(); | 45 return ws_test_helper_.window_server_delegate(); |
| 46 } | 46 } |
| 47 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } | 47 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 // testing::Test: | 50 // testing::Test: |
| 51 void SetUp() override { | 51 void SetUp() override { |
| 52 window_server_delegate()->CreateDisplays(1); | 52 platform_screen_.Init(window_server()->display_manager()); |
| 53 platform_screen_.AddDisplay(); |
| 53 | 54 |
| 54 // As a side effect, this allocates Displays. | 55 // As a side effect, this allocates Displays. |
| 55 AddWindowManager(window_server(), kTestId1); | 56 AddWindowManager(window_server(), kTestId1); |
| 56 window_server()->user_id_tracker()->AddUserId(kTestId1); | 57 window_server()->user_id_tracker()->AddUserId(kTestId1); |
| 57 window_server()->user_id_tracker()->SetActiveUserId(kTestId1); | 58 window_server()->user_id_tracker()->SetActiveUserId(kTestId1); |
| 58 } | 59 } |
| 59 | 60 |
| 60 ServerWindow* GetRoot() { | 61 ServerWindow* GetRoot() { |
| 61 DisplayManager* display_manager = window_server()->display_manager(); | 62 DisplayManager* display_manager = window_server()->display_manager(); |
| 62 // ASSERT_EQ(1u, display_manager->displays().size()); | 63 // ASSERT_EQ(1u, display_manager->displays().size()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 display->GetActiveWindowManagerDisplayRoot(); | 97 display->GetActiveWindowManagerDisplayRoot(); |
| 97 ASSERT_TRUE(active_display_root); | 98 ASSERT_TRUE(active_display_root); |
| 98 static_cast<PlatformDisplayDelegate*>(display)->OnEvent(ui::PointerEvent( | 99 static_cast<PlatformDisplayDelegate*>(display)->OnEvent(ui::PointerEvent( |
| 99 ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0))); | 100 ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0))); |
| 100 WindowManagerState* wms = active_display_root->window_manager_state(); | 101 WindowManagerState* wms = active_display_root->window_manager_state(); |
| 101 wms->OnEventAck(wms->window_tree(), mojom::EventResult::HANDLED); | 102 wms->OnEventAck(wms->window_tree(), mojom::EventResult::HANDLED); |
| 102 } | 103 } |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 WindowServerTestHelper ws_test_helper_; | 106 WindowServerTestHelper ws_test_helper_; |
| 107 TestPlatformScreen platform_screen_; |
| 106 DISALLOW_COPY_AND_ASSIGN(CursorTest); | 108 DISALLOW_COPY_AND_ASSIGN(CursorTest); |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 TEST_F(CursorTest, ChangeByMouseMove) { | 111 TEST_F(CursorTest, ChangeByMouseMove) { |
| 110 ServerWindow* win = BuildServerWindow(); | 112 ServerWindow* win = BuildServerWindow(); |
| 111 win->SetPredefinedCursor(mojom::Cursor::IBEAM); | 113 win->SetPredefinedCursor(mojom::Cursor::IBEAM); |
| 112 EXPECT_EQ(mojom::Cursor::IBEAM, win->cursor()); | 114 EXPECT_EQ(mojom::Cursor::IBEAM, win->cursor()); |
| 113 win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE); | 115 win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE); |
| 114 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, win->non_client_cursor()); | 116 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, win->non_client_cursor()); |
| 115 | 117 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 MoveCursorTo(gfx::Point(15, 15)); | 179 MoveCursorTo(gfx::Point(15, 15)); |
| 178 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, cursor()); | 180 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, cursor()); |
| 179 | 181 |
| 180 win->SetBounds(gfx::Rect(0, 0, 30, 30)); | 182 win->SetBounds(gfx::Rect(0, 0, 30, 30)); |
| 181 EXPECT_EQ(mojom::Cursor::IBEAM, cursor()); | 183 EXPECT_EQ(mojom::Cursor::IBEAM, cursor()); |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace test | 186 } // namespace test |
| 185 } // namespace ws | 187 } // namespace ws |
| 186 } // namespace ui | 188 } // namespace ui |
| OLD | NEW |