| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void SetUp() override { | 44 void SetUp() override { |
| 45 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); | 45 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); |
| 46 window_server_.reset( | 46 window_server_.reset( |
| 47 new WindowServer(&window_server_delegate_, | 47 new WindowServer(&window_server_delegate_, |
| 48 scoped_refptr<SurfacesState>(new SurfacesState))); | 48 scoped_refptr<SurfacesState>(new SurfacesState))); |
| 49 window_server_delegate_.set_window_server(window_server_.get()); | 49 window_server_delegate_.set_window_server(window_server_.get()); |
| 50 | 50 |
| 51 window_server_delegate_.set_num_displays_to_create(1); | 51 window_server_delegate_.set_num_displays_to_create(1); |
| 52 | 52 |
| 53 // As a side effect, this allocates Displays. | 53 // As a side effect, this allocates Displays. |
| 54 WindowManagerFactoryRegistryTestApi( | 54 WindowManagerWindowTreeFactorySetTestApi( |
| 55 window_server_->window_manager_factory_registry()) | 55 window_server_->window_manager_window_tree_factory_set()) |
| 56 .AddService(kTestId1, &test_window_manager_factory_); | 56 .Add(kTestId1); |
| 57 window_server_->user_id_tracker()->SetActiveUserId(kTestId1); | 57 window_server_->user_id_tracker()->SetActiveUserId(kTestId1); |
| 58 } | 58 } |
| 59 | 59 |
| 60 ServerWindow* GetRoot() { | 60 ServerWindow* GetRoot() { |
| 61 DisplayManager* display_manager = window_server_->display_manager(); | 61 DisplayManager* display_manager = window_server_->display_manager(); |
| 62 // ASSERT_EQ(1u, display_manager->displays().size()); | 62 // ASSERT_EQ(1u, display_manager->displays().size()); |
| 63 Display* display = *display_manager->displays().begin(); | 63 Display* display = *display_manager->displays().begin(); |
| 64 WindowManagerState* state = display->GetWindowManagerStateForUser(kTestId1); | 64 WindowManagerState* state = display->GetWindowManagerStateForUser(kTestId1); |
| 65 return state->root(); | 65 return state->root(); |
| 66 } | 66 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 96 ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0))); | 96 ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0))); |
| 97 active_wms->OnEventAck(active_wms->tree(), mojom::EventResult::HANDLED); | 97 active_wms->OnEventAck(active_wms->tree(), mojom::EventResult::HANDLED); |
| 98 } | 98 } |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 int32_t cursor_id_; | 101 int32_t cursor_id_; |
| 102 TestPlatformDisplayFactory platform_display_factory_; | 102 TestPlatformDisplayFactory platform_display_factory_; |
| 103 TestWindowServerDelegate window_server_delegate_; | 103 TestWindowServerDelegate window_server_delegate_; |
| 104 std::unique_ptr<WindowServer> window_server_; | 104 std::unique_ptr<WindowServer> window_server_; |
| 105 base::MessageLoop message_loop_; | 105 base::MessageLoop message_loop_; |
| 106 TestWindowManagerFactory test_window_manager_factory_; | |
| 107 | 106 |
| 108 private: | 107 private: |
| 109 DISALLOW_COPY_AND_ASSIGN(CursorTest); | 108 DISALLOW_COPY_AND_ASSIGN(CursorTest); |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 TEST_F(CursorTest, ChangeByMouseMove) { | 111 TEST_F(CursorTest, ChangeByMouseMove) { |
| 113 ServerWindow* win = BuildServerWindow(); | 112 ServerWindow* win = BuildServerWindow(); |
| 114 win->SetPredefinedCursor(mojom::Cursor::IBEAM); | 113 win->SetPredefinedCursor(mojom::Cursor::IBEAM); |
| 115 EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor())); | 114 EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor())); |
| 116 win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE); | 115 win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 MoveCursorTo(gfx::Point(15, 15)); | 184 MoveCursorTo(gfx::Point(15, 15)); |
| 186 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_)); | 185 EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_)); |
| 187 | 186 |
| 188 win->SetBounds(gfx::Rect(0, 0, 30, 30)); | 187 win->SetBounds(gfx::Rect(0, 0, 30, 30)); |
| 189 EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(cursor_id_)); | 188 EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(cursor_id_)); |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace test | 191 } // namespace test |
| 193 } // namespace ws | 192 } // namespace ws |
| 194 } // namespace mus | 193 } // namespace mus |
| OLD | NEW |