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

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: merge 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
« no previous file with comments | « services/ui/ws/event_dispatcher_unittest.cc ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 278
276 bool did_call_create_top_level_window(uint32_t* change_id) { 279 bool did_call_create_top_level_window(uint32_t* change_id) {
277 if (!got_create_top_level_window_) 280 if (!got_create_top_level_window_)
278 return false; 281 return false;
279 282
280 got_create_top_level_window_ = false; 283 got_create_top_level_window_ = false;
281 *change_id = change_id_; 284 *change_id = change_id_;
282 return true; 285 return true;
283 } 286 }
284 287
288 void ClearAcceleratorCalled() {
289 on_accelerator_id_ = 0u;
290 on_accelerator_called_ = false;
291 }
292
285 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; } 293 bool on_perform_move_loop_called() { return on_perform_move_loop_called_; }
286 bool on_accelerator_called() { return on_accelerator_called_; } 294 bool on_accelerator_called() { return on_accelerator_called_; }
287 uint32_t on_accelerator_id() { return on_accelerator_id_; } 295 uint32_t on_accelerator_id() { return on_accelerator_id_; }
288 296
289 private: 297 private:
290 // WindowManager: 298 // WindowManager:
291 void OnConnect(uint16_t client_id) override {} 299 void OnConnect(uint16_t client_id) override {}
292 void WmNewDisplayAdded(ui::mojom::DisplayPtr display, 300 void WmNewDisplayAdded(ui::mojom::DisplayPtr display,
293 ui::mojom::WindowDataPtr root, 301 ui::mojom::WindowDataPtr root,
294 bool drawn) override {} 302 bool drawn) override {}
295 void WmSetBounds(uint32_t change_id, 303 void WmSetBounds(uint32_t change_id,
296 uint32_t window_id, 304 uint32_t window_id,
297 const gfx::Rect& bounds) override {} 305 const gfx::Rect& bounds) override {}
298 void WmSetProperty(uint32_t change_id, 306 void WmSetProperty(uint32_t change_id,
299 uint32_t window_id, 307 uint32_t window_id,
300 const mojo::String& name, 308 const mojo::String& name,
301 mojo::Array<uint8_t> value) override {} 309 mojo::Array<uint8_t> value) override {}
302 void WmCreateTopLevelWindow( 310 void WmCreateTopLevelWindow(
303 uint32_t change_id, 311 uint32_t change_id,
304 ClientSpecificId requesting_client_id, 312 ClientSpecificId requesting_client_id,
305 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; 313 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override;
306 void WmClientJankinessChanged(ClientSpecificId client_id, 314 void WmClientJankinessChanged(ClientSpecificId client_id,
307 bool janky) override; 315 bool janky) override;
308 void WmPerformMoveLoop(uint32_t change_id, 316 void WmPerformMoveLoop(uint32_t change_id,
309 uint32_t window_id, 317 uint32_t window_id,
310 mojom::MoveLoopSource source, 318 mojom::MoveLoopSource source,
311 const gfx::Point& cursor_location) override; 319 const gfx::Point& cursor_location) override;
312 void WmCancelMoveLoop(uint32_t window_id) override; 320 void WmCancelMoveLoop(uint32_t window_id) override;
313 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; 321 void OnAccelerator(uint32_t ack_id,
322 uint32_t accelerator_id,
323 std::unique_ptr<ui::Event> event) override;
314 324
315 bool on_perform_move_loop_called_ = false; 325 bool on_perform_move_loop_called_ = false;
316 326
317 bool got_create_top_level_window_; 327 bool got_create_top_level_window_;
318 uint32_t change_id_; 328 uint32_t change_id_;
319 329
320 bool on_accelerator_called_; 330 bool on_accelerator_called_;
321 uint32_t on_accelerator_id_; 331 uint32_t on_accelerator_id_;
322 332
323 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); 333 DISALLOW_COPY_AND_ASSIGN(TestWindowManager);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 566 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
557 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 567 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
558 ServerWindow* parent, 568 ServerWindow* parent,
559 ClientWindowId* client_id); 569 ClientWindowId* client_id);
560 570
561 } // namespace test 571 } // namespace test
562 } // namespace ws 572 } // namespace ws
563 } // namespace ui 573 } // namespace ui
564 574
565 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 575 #endif // SERVICES_UI_WS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « services/ui/ws/event_dispatcher_unittest.cc ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698