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 <memory> | 10 #include <memory> |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // ----------------------------------------------------------------------------- | 201 // ----------------------------------------------------------------------------- |
202 | 202 |
203 class WindowManagerStateTestApi { | 203 class WindowManagerStateTestApi { |
204 public: | 204 public: |
205 explicit WindowManagerStateTestApi(WindowManagerState* wms) : wms_(wms) {} | 205 explicit WindowManagerStateTestApi(WindowManagerState* wms) : wms_(wms) {} |
206 ~WindowManagerStateTestApi() {} | 206 ~WindowManagerStateTestApi() {} |
207 | 207 |
208 void DispatchInputEventToWindow(ServerWindow* target, | 208 void DispatchInputEventToWindow(ServerWindow* target, |
209 ClientSpecificId client_id, | 209 ClientSpecificId client_id, |
210 const int64_t display_id, | 210 int64_t display_id, |
211 const ui::Event& event, | 211 const ui::Event& event, |
212 Accelerator* accelerator) { | 212 Accelerator* accelerator) { |
213 wms_->DispatchInputEventToWindow(target, client_id, display_id, event, | 213 wms_->DispatchInputEventToWindow(target, client_id, display_id, event, |
214 accelerator); | 214 accelerator); |
215 } | 215 } |
216 | 216 |
217 ClientSpecificId GetEventTargetClientId(ServerWindow* window, | 217 ClientSpecificId GetEventTargetClientId(ServerWindow* window, |
218 bool in_nonclient_area) { | 218 bool in_nonclient_area) { |
219 return wms_->GetEventTargetClientId(window, in_nonclient_area); | 219 return wms_->GetEventTargetClientId(window, in_nonclient_area); |
220 } | 220 } |
221 | 221 |
222 void ProcessEvent(const ui::Event& event, int64_t display_id = 0) { | 222 void ProcessEvent(const ui::Event& event, int64_t display_id = 0) { |
223 wms_->ProcessEvent(event, display_id); | 223 wms_->ProcessEvent(event, display_id); |
224 } | 224 } |
225 | 225 |
226 void OnEventAckTimeout(ClientSpecificId client_id) { | 226 void OnEventAckTimeout(ClientSpecificId client_id) { |
227 wms_->OnEventAckTimeout(client_id); | 227 wms_->OnEventAckTimeout(client_id); |
228 } | 228 } |
229 | 229 |
230 ClientSpecificId GetEventTargetClientId(const ServerWindow* window, | 230 ClientSpecificId GetEventTargetClientId(const ServerWindow* window, |
231 bool in_nonclient_area) { | 231 bool in_nonclient_area) { |
232 return wms_->GetEventTargetClientId(window, in_nonclient_area); | 232 return wms_->GetEventTargetClientId(window, in_nonclient_area); |
233 } | 233 } |
234 | 234 |
235 WindowTree* tree_awaiting_input_ack() { | 235 WindowTree* tree_awaiting_input_ack() { |
236 return wms_->in_flight_event_details_ ? wms_->in_flight_event_details_->tree | 236 return wms_->in_flight_event_dispatch_details_ |
237 : nullptr; | 237 ? wms_->in_flight_event_dispatch_details_->tree |
| 238 : nullptr; |
238 } | 239 } |
239 | 240 |
| 241 bool is_event_queue_empty() const { return wms_->event_queue_.empty(); } |
| 242 |
240 const std::vector<std::unique_ptr<WindowManagerDisplayRoot>>& | 243 const std::vector<std::unique_ptr<WindowManagerDisplayRoot>>& |
241 window_manager_display_roots() const { | 244 window_manager_display_roots() const { |
242 return wms_->window_manager_display_roots_; | 245 return wms_->window_manager_display_roots_; |
243 } | 246 } |
244 | 247 |
245 bool AckInFlightEvent(mojom::EventResult result) { | 248 bool AckInFlightEvent(mojom::EventResult result) { |
246 if (!wms_->in_flight_event_details_) | 249 if (!wms_->in_flight_event_dispatch_details_) |
247 return false; | 250 return false; |
248 wms_->OnEventAck(wms_->in_flight_event_details_->tree, result); | 251 wms_->OnEventAck(wms_->in_flight_event_dispatch_details_->tree, result); |
249 return true; | 252 return true; |
250 } | 253 } |
251 | 254 |
252 private: | 255 private: |
253 WindowManagerState* wms_; | 256 WindowManagerState* wms_; |
254 | 257 |
255 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestApi); | 258 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestApi); |
256 }; | 259 }; |
257 | 260 |
258 // ----------------------------------------------------------------------------- | 261 // ----------------------------------------------------------------------------- |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 ClientWindowId* client_id = nullptr); | 759 ClientWindowId* client_id = nullptr); |
757 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 760 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
758 ServerWindow* parent, | 761 ServerWindow* parent, |
759 ClientWindowId* client_id = nullptr); | 762 ClientWindowId* client_id = nullptr); |
760 | 763 |
761 } // namespace test | 764 } // namespace test |
762 } // namespace ws | 765 } // namespace ws |
763 } // namespace ui | 766 } // namespace ui |
764 | 767 |
765 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 768 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
OLD | NEW |