OLD | NEW |
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 Loading... |
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 Loading... |
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_accelerator_called() { return on_accelerator_called_; } | 273 bool on_accelerator_called() { return on_accelerator_called_; } |
266 uint32_t on_accelerator_id() { return on_accelerator_id_; } | 274 uint32_t on_accelerator_id() { return on_accelerator_id_; } |
267 | 275 |
268 private: | 276 private: |
269 // WindowManager: | 277 // WindowManager: |
270 void OnConnect(uint16_t client_id) override {} | 278 void OnConnect(uint16_t client_id) override {} |
271 void WmNewDisplayAdded(ui::mojom::DisplayPtr display, | 279 void WmNewDisplayAdded(ui::mojom::DisplayPtr display, |
272 ui::mojom::WindowDataPtr root, | 280 ui::mojom::WindowDataPtr root, |
273 bool drawn) override {} | 281 bool drawn) override {} |
274 void WmSetBounds(uint32_t change_id, | 282 void WmSetBounds(uint32_t change_id, |
275 uint32_t window_id, | 283 uint32_t window_id, |
276 const gfx::Rect& bounds) override {} | 284 const gfx::Rect& bounds) override {} |
277 void WmSetProperty(uint32_t change_id, | 285 void WmSetProperty(uint32_t change_id, |
278 uint32_t window_id, | 286 uint32_t window_id, |
279 const mojo::String& name, | 287 const mojo::String& name, |
280 mojo::Array<uint8_t> value) override {} | 288 mojo::Array<uint8_t> value) override {} |
281 void WmCreateTopLevelWindow( | 289 void WmCreateTopLevelWindow( |
282 uint32_t change_id, | 290 uint32_t change_id, |
283 ClientSpecificId requesting_client_id, | 291 ClientSpecificId requesting_client_id, |
284 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; | 292 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override; |
285 void WmClientJankinessChanged(ClientSpecificId client_id, | 293 void WmClientJankinessChanged(ClientSpecificId client_id, |
286 bool janky) override; | 294 bool janky) override; |
287 void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override; | 295 void OnAccelerator(uint32_t ack_id, |
| 296 uint32_t accelerator_id, |
| 297 std::unique_ptr<ui::Event> event) override; |
288 | 298 |
289 bool got_create_top_level_window_; | 299 bool got_create_top_level_window_; |
290 uint32_t change_id_; | 300 uint32_t change_id_; |
291 | 301 |
292 bool on_accelerator_called_; | 302 bool on_accelerator_called_; |
293 uint32_t on_accelerator_id_; | 303 uint32_t on_accelerator_id_; |
294 | 304 |
295 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); | 305 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); |
296 }; | 306 }; |
297 | 307 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 538 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
529 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 539 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
530 ServerWindow* parent, | 540 ServerWindow* parent, |
531 ClientWindowId* client_id); | 541 ClientWindowId* client_id); |
532 | 542 |
533 } // namespace test | 543 } // namespace test |
534 } // namespace ws | 544 } // namespace ws |
535 } // namespace ui | 545 } // namespace ui |
536 | 546 |
537 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 547 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
OLD | NEW |