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

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

Issue 2125883003: Adds ability for pre-target accelerators to not consume events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 5 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 #ifndef SERVICES_UI_WS_TEST_UTILS_H_ 5 #ifndef SERVICES_UI_WS_TEST_UTILS_H_
6 #define SERVICES_UI_WS_TEST_UTILS_H_ 6 #define SERVICES_UI_WS_TEST_UTILS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 tree_->window_manager_internal_ = wm_internal; 95 tree_->window_manager_internal_ = wm_internal;
96 } 96 }
97 void AckOldestEvent() { 97 void AckOldestEvent() {
98 tree_->OnWindowInputEventAck(tree_->event_ack_id_, 98 tree_->OnWindowInputEventAck(tree_->event_ack_id_,
99 mojom::EventResult::UNHANDLED); 99 mojom::EventResult::UNHANDLED);
100 } 100 }
101 void EnableCapture() { tree_->event_ack_id_ = 1u; } 101 void EnableCapture() { tree_->event_ack_id_ = 1u; }
102 void AckLastEvent(mojom::EventResult result) { 102 void AckLastEvent(mojom::EventResult result) {
103 tree_->OnWindowInputEventAck(tree_->event_ack_id_, result); 103 tree_->OnWindowInputEventAck(tree_->event_ack_id_, result);
104 } 104 }
105 void AckLastAccelerator(mojom::EventResult result) {
106 tree_->OnAcceleratorAck(tree_->event_ack_id_, result);
107 }
105 108
106 void SetEventObserver(mojom::EventMatcherPtr matcher, 109 void SetEventObserver(mojom::EventMatcherPtr matcher,
107 uint32_t event_observer_id); 110 uint32_t event_observer_id);
108 111
109 private: 112 private:
110 WindowTree* tree_; 113 WindowTree* tree_;
111 114
112 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi); 115 DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi);
113 }; 116 };
114 117
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 258
256 bool did_call_create_top_level_window(uint32_t* change_id) { 259 bool did_call_create_top_level_window(uint32_t* change_id) {
257 if (!got_create_top_level_window_) 260 if (!got_create_top_level_window_)
258 return false; 261 return false;
259 262
260 got_create_top_level_window_ = false; 263 got_create_top_level_window_ = false;
261 *change_id = change_id_; 264 *change_id = change_id_;
262 return true; 265 return true;
263 } 266 }
264 267
268 void ClearAcceleratorCalled() {
269 on_accelerator_id_ = 0u;
270 on_accelerator_called_ = false;
271 }
272
265 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; } 273 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; }
266 bool on_accelerator_called() { return on_accelerator_called_; } 274 bool on_accelerator_called() { return on_accelerator_called_; }
267 uint32_t on_accelerator_id() { return on_accelerator_id_; } 275 uint32_t on_accelerator_id() { return on_accelerator_id_; }
268 276
269 private: 277 private:
270 // WindowManager: 278 // WindowManager:
271 void OnConnect(uint16_t client_id) override {} 279 void OnConnect(uint16_t client_id) override {}
272 void WmNewDisplayAdded(ui::mojom::DisplayPtr display, 280 void WmNewDisplayAdded(ui::mojom::DisplayPtr display,
273 ui::mojom::WindowDataPtr root, 281 ui::mojom::WindowDataPtr root,
274 bool drawn) override {} 282 bool drawn) override {}
275 void WmSetBounds(uint32_t change_id, 283 void WmSetBounds(uint32_t change_id,
276 uint32_t window_id, 284 uint32_t window_id,
277 const gfx::Rect& bounds) override {} 285 const gfx::Rect& bounds) override {}
278 void WmSetProperty(uint32_t change_id, 286 void WmSetProperty(uint32_t change_id,
279 uint32_t window_id, 287 uint32_t window_id,
280 const mojo::String& name, 288 const mojo::String& name,
281 mojo::Array<uint8_t> value) override {} 289 mojo::Array<uint8_t> value) override {}
282 void WmCreateTopLevelWindow( 290 void WmCreateTopLevelWindow(
283 uint32_t change_id, 291 uint32_t change_id,
284 ClientSpecificId requesting_client_id, 292 ClientSpecificId requesting_client_id,
285 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; 293 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override;
286 void WmClientJankinessChanged(ClientSpecificId client_id, 294 void WmClientJankinessChanged(ClientSpecificId client_id,
287 bool janky) override; 295 bool janky) override;
288 void WmPerformMoveLoop(uint32_t change_id, 296 void WmPerformMoveLoop(uint32_t change_id,
289 uint32_t window_id, 297 uint32_t window_id,
290 mojom::MoveLoopSource source, 298 mojom::MoveLoopSource source,
291 const gfx::Point& cursor_location) override; 299 const gfx::Point& cursor_location) override;
292 void WmCancelMoveLoop(uint32_t window_id) override; 300 void WmCancelMoveLoop(uint32_t window_id) override;
293 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; 301 void OnAccelerator(uint32_t ack_id,
302 uint32_t accelerator_id,
303 std::unique_ptr<ui::Event> event) override;
294 304
295 bool on_perform_move_loop_called_ = false; 305 bool on_perform_move_loop_called_ = false;
296 306
297 bool got_create_top_level_window_; 307 bool got_create_top_level_window_;
298 uint32_t change_id_; 308 uint32_t change_id_;
299 309
300 bool on_accelerator_called_; 310 bool on_accelerator_called_;
301 uint32_t on_accelerator_id_; 311 uint32_t on_accelerator_id_;
302 312
303 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); 313 DISALLOW_COPY_AND_ASSIGN(TestWindowManager);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 546 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
537 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 547 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
538 ServerWindow* parent, 548 ServerWindow* parent,
539 ClientWindowId* client_id); 549 ClientWindowId* client_id);
540 550
541 } // namespace test 551 } // namespace test
542 } // namespace ws 552 } // namespace ws
543 } // namespace ui 553 } // namespace ui
544 554
545 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 555 #endif // SERVICES_UI_WS_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698