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

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: . 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 "cc/output/copy_output_request.h" 7 #include "cc/output/copy_output_request.h"
8 #include "components/mus/surfaces/surfaces_state.h" 8 #include "components/mus/surfaces/surfaces_state.h"
9 #include "components/mus/ws/display_binding.h" 9 #include "components/mus/ws/display_binding.h"
10 #include "components/mus/ws/window_manager_access_policy.h" 10 #include "components/mus/ws/window_manager_access_policy.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() { 103 PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() {
104 return new TestPlatformDisplay(cursor_id_storage_); 104 return new TestPlatformDisplay(cursor_id_storage_);
105 } 105 }
106 106
107 // WindowTreeTestApi --------------------------------------------------------- 107 // WindowTreeTestApi ---------------------------------------------------------
108 108
109 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} 109 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {}
110 WindowTreeTestApi::~WindowTreeTestApi() {} 110 WindowTreeTestApi::~WindowTreeTestApi() {}
111 111
112 void WindowTreeTestApi::SetEventObserver(mojom::EventMatcherPtr matcher) {
113 tree_->SetEventObserver(std::move(matcher));
114 }
115
116 void WindowTreeTestApi::ClearEventObserver() {
117 tree_->ClearEventObserver();
118 }
119
112 // DisplayTestApi ------------------------------------------------------------ 120 // DisplayTestApi ------------------------------------------------------------
113 121
114 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} 122 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {}
115 DisplayTestApi::~DisplayTestApi() {} 123 DisplayTestApi::~DisplayTestApi() {}
116 124
117 // EventDispatcherTestApi ---------------------------------------------------- 125 // EventDispatcherTestApi ----------------------------------------------------
118 126
119 int EventDispatcherTestApi::NumberPointerTargetsForWindow( 127 int EventDispatcherTestApi::NumberPointerTargetsForWindow(
120 ServerWindow* window) { 128 ServerWindow* window) {
121 int count = 0; 129 int count = 0;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 mojo::Array<uint8_t> new_data) { 260 mojo::Array<uint8_t> new_data) {
253 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); 261 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
254 } 262 }
255 263
256 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, 264 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id,
257 uint32_t window, 265 uint32_t window,
258 mojom::EventPtr event) { 266 mojom::EventPtr event) {
259 tracker_.OnWindowInputEvent(window, std::move(event)); 267 tracker_.OnWindowInputEvent(window, std::move(event));
260 } 268 }
261 269
270 void TestWindowTreeClient::OnEventObserved(mojom::EventPtr event) {
271 tracker_.OnEventObserved(std::move(event));
272 }
273
262 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { 274 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
263 tracker_.OnWindowFocused(focused_window_id); 275 tracker_.OnWindowFocused(focused_window_id);
264 } 276 }
265 277
266 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( 278 void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
267 uint32_t window_id, 279 uint32_t window_id,
268 mojom::Cursor cursor_id) { 280 mojom::Cursor cursor_id) {
269 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); 281 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
270 } 282 }
271 283
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return nullptr; 375 return nullptr;
364 if (!tree->AddWindow(parent_client_id, client_window_id)) 376 if (!tree->AddWindow(parent_client_id, client_window_id))
365 return nullptr; 377 return nullptr;
366 *client_id = client_window_id; 378 *client_id = client_window_id;
367 return tree->GetWindowByClientId(client_window_id); 379 return tree->GetWindowByClientId(client_window_id);
368 } 380 }
369 381
370 } // namespace test 382 } // namespace test
371 } // namespace ws 383 } // namespace ws
372 } // namespace mus 384 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698