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

Side by Side Diff: components/mus/ws/test_utils.cc

Issue 1909733002: mus: Add EventObserver to allow passively listening to UI events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 "components/mus/ws/test_utils.h" 5 #include "components/mus/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 "components/mus/surfaces/surfaces_state.h" 9 #include "components/mus/surfaces/surfaces_state.h"
10 #include "components/mus/ws/display_binding.h" 10 #include "components/mus/ws/display_binding.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() { 104 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() {
105 return new TestPlatformDisplay(cursor_id_storage_); 105 return new TestPlatformDisplay(cursor_id_storage_);
106 } 106 }
107 107
108 // WindowTreeTestApi --------------------------------------------------------- 108 // WindowTreeTestApi ---------------------------------------------------------
109 109
110 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} 110 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {}
111 WindowTreeTestApi::~WindowTreeTestApi() {} 111 WindowTreeTestApi::~WindowTreeTestApi() {}
112 112
113 void WindowTreeTestApi::SetEventObserver(mojom::EventMatcherPtr matcher,
114 uint32_t event_observer_id) {
115 tree_->SetEventObserver(std::move(matcher), event_observer_id);
116 }
117
113 // DisplayTestApi ------------------------------------------------------------ 118 // DisplayTestApi ------------------------------------------------------------
114 119
115 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} 120 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {}
116 DisplayTestApi::~DisplayTestApi() {} 121 DisplayTestApi::~DisplayTestApi() {}
117 122
118 // EventDispatcherTestApi ---------------------------------------------------- 123 // EventDispatcherTestApi ----------------------------------------------------
119 124
120 int EventDispatcherTestApi::NumberPointerTargetsForWindow( 125 int EventDispatcherTestApi::NumberPointerTargetsForWindow(
121 ServerWindow* window) { 126 ServerWindow* window) {
122 int count = 0; 127 int count = 0;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 254
250 void TestWindowTreeClient::OnWindowSharedPropertyChanged( 255 void TestWindowTreeClient::OnWindowSharedPropertyChanged(
251 uint32_t window, 256 uint32_t window,
252 const mojo::String& name, 257 const mojo::String& name,
253 mojo::Array<uint8_t> new_data) { 258 mojo::Array<uint8_t> new_data) {
254 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); 259 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
255 } 260 }
256 261
257 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, 262 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id,
258 uint32_t window, 263 uint32_t window,
259 mojom::EventPtr event) { 264 mojom::EventPtr event,
260 tracker_.OnWindowInputEvent(window, std::move(event)); 265 uint32_t event_observer_id) {
266 tracker_.OnWindowInputEvent(window, std::move(event), event_observer_id);
267 }
268
269 void TestWindowTreeClient::OnEventObserved(mojom::EventPtr event,
270 uint32_t event_observer_id) {
271 tracker_.OnEventObserved(std::move(event), event_observer_id);
261 } 272 }
262 273
263 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { 274 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
264 tracker_.OnWindowFocused(focused_window_id); 275 tracker_.OnWindowFocused(focused_window_id);
265 } 276 }
266 277
267 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( 278 void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
268 uint32_t window_id, 279 uint32_t window_id,
269 mojom::Cursor cursor_id) { 280 mojom::Cursor cursor_id) {
270 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); 281 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return nullptr; 381 return nullptr;
371 if (!tree->AddWindow(parent_client_id, client_window_id)) 382 if (!tree->AddWindow(parent_client_id, client_window_id))
372 return nullptr; 383 return nullptr;
373 *client_id = client_window_id; 384 *client_id = client_window_id;
374 return tree->GetWindowByClientId(client_window_id); 385 return tree->GetWindowByClientId(client_window_id);
375 } 386 }
376 387
377 } // namespace test 388 } // namespace test
378 } // namespace ws 389 } // namespace ws
379 } // namespace mus 390 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698