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/test_utils.h" | 5 #include "services/ui/ws/test_utils.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "services/shell/public/interfaces/connector.mojom.h" | 9 #include "services/shell/public/interfaces/connector.mojom.h" |
10 #include "services/ui/surfaces/surfaces_state.h" | 10 #include "services/ui/surfaces/surfaces_state.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() { | 107 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() { |
108 return new TestPlatformDisplay(cursor_id_storage_); | 108 return new TestPlatformDisplay(cursor_id_storage_); |
109 } | 109 } |
110 | 110 |
111 // WindowTreeTestApi --------------------------------------------------------- | 111 // WindowTreeTestApi --------------------------------------------------------- |
112 | 112 |
113 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} | 113 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} |
114 WindowTreeTestApi::~WindowTreeTestApi() {} | 114 WindowTreeTestApi::~WindowTreeTestApi() {} |
115 | 115 |
116 void WindowTreeTestApi::SetEventObserver(mojom::EventMatcherPtr matcher, | 116 void WindowTreeTestApi::AddEventObserver(mojom::EventMatcherPtr matcher, |
117 uint32_t event_observer_id) { | 117 uint32_t event_observer_id) { |
118 tree_->SetEventObserver(std::move(matcher), event_observer_id); | 118 tree_->AddEventObserver(std::move(matcher), event_observer_id); |
| 119 } |
| 120 |
| 121 void WindowTreeTestApi::RemoveEventObserver(uint32_t event_observer_id) { |
| 122 tree_->RemoveEventObserver(event_observer_id); |
119 } | 123 } |
120 | 124 |
121 // DisplayTestApi ------------------------------------------------------------ | 125 // DisplayTestApi ------------------------------------------------------------ |
122 | 126 |
123 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} | 127 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} |
124 DisplayTestApi::~DisplayTestApi() {} | 128 DisplayTestApi::~DisplayTestApi() {} |
125 | 129 |
126 // EventDispatcherTestApi ---------------------------------------------------- | 130 // EventDispatcherTestApi ---------------------------------------------------- |
127 | 131 |
128 bool EventDispatcherTestApi::IsWindowPointerTarget( | 132 bool EventDispatcherTestApi::IsWindowPointerTarget( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 tracker_.OnWindowParentDrawnStateChanged(window, drawn); | 279 tracker_.OnWindowParentDrawnStateChanged(window, drawn); |
276 } | 280 } |
277 | 281 |
278 void TestWindowTreeClient::OnWindowSharedPropertyChanged( | 282 void TestWindowTreeClient::OnWindowSharedPropertyChanged( |
279 uint32_t window, | 283 uint32_t window, |
280 const mojo::String& name, | 284 const mojo::String& name, |
281 mojo::Array<uint8_t> new_data) { | 285 mojo::Array<uint8_t> new_data) { |
282 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); | 286 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); |
283 } | 287 } |
284 | 288 |
285 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, | 289 void TestWindowTreeClient::OnWindowInputEvent( |
286 uint32_t window, | 290 uint32_t event_id, uint32_t window, std::unique_ptr<ui::Event> event, |
287 std::unique_ptr<ui::Event> event, | 291 mojo::Array<uint32_t> event_observer_ids) { |
288 uint32_t event_observer_id) { | 292 tracker_.OnWindowInputEvent(window, *event.get(), |
289 tracker_.OnWindowInputEvent(window, *event.get(), event_observer_id); | 293 std::move(event_observer_ids)); |
290 } | 294 } |
291 | 295 |
292 void TestWindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event, | 296 void TestWindowTreeClient::OnEventObserved( |
293 uint32_t event_observer_id) { | 297 std::unique_ptr<ui::Event> event, mojo::Array<uint32_t> event_observer_ids) { |
294 tracker_.OnEventObserved(*event.get(), event_observer_id); | 298 tracker_.OnEventObserved(*event.get(), std::move(event_observer_ids)); |
295 } | 299 } |
296 | 300 |
297 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { | 301 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { |
298 tracker_.OnWindowFocused(focused_window_id); | 302 tracker_.OnWindowFocused(focused_window_id); |
299 } | 303 } |
300 | 304 |
301 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( | 305 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( |
302 uint32_t window_id, | 306 uint32_t window_id, |
303 mojom::Cursor cursor_id) { | 307 mojom::Cursor cursor_id) { |
304 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); | 308 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return nullptr; | 501 return nullptr; |
498 if (!tree->AddWindow(parent_client_id, client_window_id)) | 502 if (!tree->AddWindow(parent_client_id, client_window_id)) |
499 return nullptr; | 503 return nullptr; |
500 *client_id = client_window_id; | 504 *client_id = client_window_id; |
501 return tree->GetWindowByClientId(client_window_id); | 505 return tree->GetWindowByClientId(client_window_id); |
502 } | 506 } |
503 | 507 |
504 } // namespace test | 508 } // namespace test |
505 } // namespace ws | 509 } // namespace ws |
506 } // namespace ui | 510 } // namespace ui |
OLD | NEW |