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

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: review comments 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
112 // DisplayTestApi ------------------------------------------------------------ 116 // DisplayTestApi ------------------------------------------------------------
113 117
114 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {} 118 DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {}
115 DisplayTestApi::~DisplayTestApi() {} 119 DisplayTestApi::~DisplayTestApi() {}
116 120
117 // EventDispatcherTestApi ---------------------------------------------------- 121 // EventDispatcherTestApi ----------------------------------------------------
118 122
119 int EventDispatcherTestApi::NumberPointerTargetsForWindow( 123 int EventDispatcherTestApi::NumberPointerTargetsForWindow(
120 ServerWindow* window) { 124 ServerWindow* window) {
121 int count = 0; 125 int count = 0;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 252
249 void TestWindowTreeClient::OnWindowSharedPropertyChanged( 253 void TestWindowTreeClient::OnWindowSharedPropertyChanged(
250 uint32_t window, 254 uint32_t window,
251 const mojo::String& name, 255 const mojo::String& name,
252 mojo::Array<uint8_t> new_data) { 256 mojo::Array<uint8_t> new_data) {
253 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); 257 tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
254 } 258 }
255 259
256 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id, 260 void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id,
257 uint32_t window, 261 uint32_t window,
258 mojom::EventPtr event) { 262 mojom::EventPtr event,
259 tracker_.OnWindowInputEvent(window, std::move(event)); 263 bool matched_observer) {
264 tracker_.OnWindowInputEvent(window, std::move(event), matched_observer);
265 }
266
267 void TestWindowTreeClient::OnEventObserved(mojom::EventPtr event) {
268 tracker_.OnEventObserved(std::move(event));
260 } 269 }
261 270
262 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { 271 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
263 tracker_.OnWindowFocused(focused_window_id); 272 tracker_.OnWindowFocused(focused_window_id);
264 } 273 }
265 274
266 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( 275 void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
267 uint32_t window_id, 276 uint32_t window_id,
268 mojom::Cursor cursor_id) { 277 mojom::Cursor cursor_id) {
269 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); 278 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return nullptr; 372 return nullptr;
364 if (!tree->AddWindow(parent_client_id, client_window_id)) 373 if (!tree->AddWindow(parent_client_id, client_window_id))
365 return nullptr; 374 return nullptr;
366 *client_id = client_window_id; 375 *client_id = client_window_id;
367 return tree->GetWindowByClientId(client_window_id); 376 return tree->GetWindowByClientId(client_window_id);
368 } 377 }
369 378
370 } // namespace test 379 } // namespace test
371 } // namespace ws 380 } // namespace ws
372 } // namespace mus 381 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698