Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: services/ui/ws/test_utils.cc

Issue 2183163002: mus: Change PointerWatcher to observe all pointer events, with moves optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Event conversion; comments; rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 const ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() { 132 const ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() {
133 return metrics_; 133 return metrics_;
134 } 134 }
135 135
136 // WindowTreeTestApi --------------------------------------------------------- 136 // WindowTreeTestApi ---------------------------------------------------------
137 137
138 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} 138 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {}
139 WindowTreeTestApi::~WindowTreeTestApi() {} 139 WindowTreeTestApi::~WindowTreeTestApi() {}
140 140
141 void WindowTreeTestApi::SetEventObserver(mojom::EventMatcherPtr matcher, 141 void WindowTreeTestApi::StartPointerWatcher(bool want_moves,
142 uint32_t event_observer_id) { 142 uint32_t pointer_watcher_id) {
143 tree_->SetEventObserver(std::move(matcher), event_observer_id); 143 tree_->StartPointerWatcher(want_moves, pointer_watcher_id);
144 }
145
146 void WindowTreeTestApi::StopPointerWatcher() {
147 tree_->StopPointerWatcher();
144 } 148 }
145 149
146 // DisplayTestApi ------------------------------------------------------------ 150 // DisplayTestApi ------------------------------------------------------------
147 151
148 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} 152 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {}
149 DisplayTestApi::~DisplayTestApi() {} 153 DisplayTestApi::~DisplayTestApi() {}
150 154
151 // EventDispatcherTestApi ---------------------------------------------------- 155 // EventDispatcherTestApi ----------------------------------------------------
152 156
153 bool EventDispatcherTestApi::IsWindowPointerTarget( 157 bool EventDispatcherTestApi::IsWindowPointerTarget(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); 312 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
309 } 313 }
310 314
311 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, 315 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id,
312 uint32_t window, 316 uint32_t window,
313 std::unique_ptr<ui::Event> event, 317 std::unique_ptr<ui::Event> event,
314 uint32_t event_observer_id) { 318 uint32_t event_observer_id) {
315 tracker_.OnWindowInputEvent(window, *event.get(), event_observer_id); 319 tracker_.OnWindowInputEvent(window, *event.get(), event_observer_id);
316 } 320 }
317 321
318 void TestWindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event, 322 void TestWindowTreeClient::OnPointerWatcherEvent(
319 uint32_t event_observer_id) { 323 std::unique_ptr<ui::Event> event,
320 tracker_.OnEventObserved(*event.get(), event_observer_id); 324 uint32_t event_observer_id) {
325 tracker_.OnPointerWatcherEvent(*event.get(), event_observer_id);
321 } 326 }
322 327
323 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { 328 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
324 tracker_.OnWindowFocused(focused_window_id); 329 tracker_.OnWindowFocused(focused_window_id);
325 } 330 }
326 331
327 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( 332 void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
328 uint32_t window_id, 333 uint32_t window_id,
329 mojom::Cursor cursor_id) { 334 mojom::Cursor cursor_id) {
330 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); 335 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return nullptr; 528 return nullptr;
524 if (!tree->AddWindow(parent_client_id, client_window_id)) 529 if (!tree->AddWindow(parent_client_id, client_window_id))
525 return nullptr; 530 return nullptr;
526 *client_id = client_window_id; 531 *client_id = client_window_id;
527 return tree->GetWindowByClientId(client_window_id); 532 return tree->GetWindowByClientId(client_window_id);
528 } 533 }
529 534
530 } // namespace test 535 } // namespace test
531 } // namespace ws 536 } // namespace ws
532 } // namespace ui 537 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698