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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "services/ui/public/interfaces/display.mojom.h" | 14 #include "services/ui/public/interfaces/display.mojom.h" |
15 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 16 #include "services/ui/ws/current_drag_operation.h" |
16 #include "services/ui/ws/display.h" | 17 #include "services/ui/ws/display.h" |
17 #include "services/ui/ws/display_binding.h" | 18 #include "services/ui/ws/display_binding.h" |
18 #include "services/ui/ws/event_dispatcher.h" | 19 #include "services/ui/ws/event_dispatcher.h" |
19 #include "services/ui/ws/platform_display.h" | 20 #include "services/ui/ws/platform_display.h" |
20 #include "services/ui/ws/platform_display_factory.h" | 21 #include "services/ui/ws/platform_display_factory.h" |
21 #include "services/ui/ws/test_change_tracker.h" | 22 #include "services/ui/ws/test_change_tracker.h" |
22 #include "services/ui/ws/user_activity_monitor.h" | 23 #include "services/ui/ws/user_activity_monitor.h" |
23 #include "services/ui/ws/user_display_manager.h" | 24 #include "services/ui/ws/user_display_manager.h" |
24 #include "services/ui/ws/user_id.h" | 25 #include "services/ui/ws/user_id.h" |
25 #include "services/ui/ws/window_manager_state.h" | 26 #include "services/ui/ws/window_manager_state.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 211 } |
211 | 212 |
212 private: | 213 private: |
213 WindowManagerState* wms_; | 214 WindowManagerState* wms_; |
214 | 215 |
215 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestApi); | 216 DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestApi); |
216 }; | 217 }; |
217 | 218 |
218 // ----------------------------------------------------------------------------- | 219 // ----------------------------------------------------------------------------- |
219 | 220 |
| 221 class CurrentDragOperationTestApi { |
| 222 public: |
| 223 explicit CurrentDragOperationTestApi(CurrentDragOperation* op) : op_(op) {} |
| 224 ~CurrentDragOperationTestApi() {} |
| 225 |
| 226 size_t GetSizeOfQueueForWindow(ServerWindow* window) { |
| 227 return op_->GetSizeOfQueueForWindow(window); |
| 228 } |
| 229 |
| 230 ServerWindow* GetCurrentTarget() { return op_->current_target_window_; } |
| 231 |
| 232 private: |
| 233 CurrentDragOperation* op_; |
| 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(CurrentDragOperationTestApi); |
| 236 }; |
| 237 |
| 238 // ----------------------------------------------------------------------------- |
| 239 |
220 // Factory that always embeds the new WindowTree as the root user id. | 240 // Factory that always embeds the new WindowTree as the root user id. |
221 class TestDisplayBinding : public DisplayBinding { | 241 class TestDisplayBinding : public DisplayBinding { |
222 public: | 242 public: |
223 explicit TestDisplayBinding(WindowServer* window_server) | 243 explicit TestDisplayBinding(WindowServer* window_server) |
224 : window_server_(window_server) {} | 244 : window_server_(window_server) {} |
225 ~TestDisplayBinding() override {} | 245 ~TestDisplayBinding() override {} |
226 | 246 |
227 private: | 247 private: |
228 // DisplayBinding: | 248 // DisplayBinding: |
229 WindowTree* CreateWindowTree(ServerWindow* root) override; | 249 WindowTree* CreateWindowTree(ServerWindow* root) override; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 mojo::Array<uint8_t> new_data) override; | 424 mojo::Array<uint8_t> new_data) override; |
405 void OnWindowInputEvent(uint32_t event_id, | 425 void OnWindowInputEvent(uint32_t event_id, |
406 uint32_t window, | 426 uint32_t window, |
407 std::unique_ptr<ui::Event> event, | 427 std::unique_ptr<ui::Event> event, |
408 bool matches_pointer_watcher) override; | 428 bool matches_pointer_watcher) override; |
409 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, | 429 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, |
410 uint32_t window_id) override; | 430 uint32_t window_id) override; |
411 void OnWindowFocused(uint32_t focused_window_id) override; | 431 void OnWindowFocused(uint32_t focused_window_id) override; |
412 void OnWindowPredefinedCursorChanged(uint32_t window_id, | 432 void OnWindowPredefinedCursorChanged(uint32_t window_id, |
413 mojom::Cursor cursor_id) override; | 433 mojom::Cursor cursor_id) override; |
| 434 void OnDragStart( |
| 435 Id window_id, |
| 436 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override; |
| 437 void OnDragEnter(uint32_t window, |
| 438 uint32_t key_state, |
| 439 const gfx::Point& position, |
| 440 uint32_t effect_bitmask, |
| 441 const OnDragEnterCallback& callback) override; |
| 442 void OnDragOver(uint32_t window, |
| 443 uint32_t key_state, |
| 444 const gfx::Point& position, |
| 445 uint32_t effect_bitmask, |
| 446 const OnDragOverCallback& callback) override; |
| 447 void OnDragLeave(uint32_t window) override; |
| 448 void OnDragDrop(uint32_t window, |
| 449 uint32_t key_state, |
| 450 const gfx::Point& position, |
| 451 uint32_t effect_bitmask, |
| 452 const OnDragDropCallback& callback) override; |
| 453 void OnDragFinish(Id window_id) override; |
414 void OnChangeCompleted(uint32_t change_id, bool success) override; | 454 void OnChangeCompleted(uint32_t change_id, bool success) override; |
415 void RequestClose(uint32_t window_id) override; | 455 void RequestClose(uint32_t window_id) override; |
416 void GetWindowManager( | 456 void GetWindowManager( |
417 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override; | 457 mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override; |
418 | 458 |
419 TestChangeTracker tracker_; | 459 TestChangeTracker tracker_; |
420 mojo::Binding<mojom::WindowTreeClient> binding_; | 460 mojo::Binding<mojom::WindowTreeClient> binding_; |
421 bool record_on_change_completed_ = false; | 461 bool record_on_change_completed_ = false; |
422 | 462 |
423 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); | 463 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); | 617 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); |
578 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, | 618 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, |
579 ServerWindow* parent, | 619 ServerWindow* parent, |
580 ClientWindowId* client_id); | 620 ClientWindowId* client_id); |
581 | 621 |
582 } // namespace test | 622 } // namespace test |
583 } // namespace ws | 623 } // namespace ws |
584 } // namespace ui | 624 } // namespace ui |
585 | 625 |
586 #endif // SERVICES_UI_WS_TEST_UTILS_H_ | 626 #endif // SERVICES_UI_WS_TEST_UTILS_H_ |
OLD | NEW |