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

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

Issue 2830703003: [views-mus] Support custom cursors. (Closed)
Patch Set: fix cast_shell_linux Created 3 years, 7 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/test_change_tracker.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 <memory> 10 #include <memory>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // ----------------------------------------------------------------------------- 145 // -----------------------------------------------------------------------------
146 146
147 class DisplayTestApi { 147 class DisplayTestApi {
148 public: 148 public:
149 explicit DisplayTestApi(Display* display); 149 explicit DisplayTestApi(Display* display);
150 ~DisplayTestApi(); 150 ~DisplayTestApi();
151 151
152 void OnEvent(ui::Event* event) { display_->OnEventFromSource(event); } 152 void OnEvent(ui::Event* event) { display_->OnEventFromSource(event); }
153 153
154 mojom::CursorType last_cursor() const { return display_->last_cursor_; } 154 const ui::CursorData& last_cursor() const { return display_->last_cursor_; }
155 155
156 private: 156 private:
157 Display* display_; 157 Display* display_;
158 158
159 DISALLOW_COPY_AND_ASSIGN(DisplayTestApi); 159 DISALLOW_COPY_AND_ASSIGN(DisplayTestApi);
160 }; 160 };
161 161
162 // ----------------------------------------------------------------------------- 162 // -----------------------------------------------------------------------------
163 163
164 class EventDispatcherTestApi { 164 class EventDispatcherTestApi {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 const bool automatically_create_display_roots_; 293 const bool automatically_create_display_roots_;
294 294
295 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); 295 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding);
296 }; 296 };
297 297
298 // ----------------------------------------------------------------------------- 298 // -----------------------------------------------------------------------------
299 299
300 // Factory that dispenses TestPlatformDisplays. 300 // Factory that dispenses TestPlatformDisplays.
301 class TestPlatformDisplayFactory : public PlatformDisplayFactory { 301 class TestPlatformDisplayFactory : public PlatformDisplayFactory {
302 public: 302 public:
303 explicit TestPlatformDisplayFactory(mojom::CursorType* cursor_storage); 303 explicit TestPlatformDisplayFactory(ui::CursorData* cursor_storage);
304 ~TestPlatformDisplayFactory(); 304 ~TestPlatformDisplayFactory();
305 305
306 // PlatformDisplayFactory: 306 // PlatformDisplayFactory:
307 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay( 307 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay(
308 ServerWindow* root_window, 308 ServerWindow* root_window,
309 const display::ViewportMetrics& metrics) override; 309 const display::ViewportMetrics& metrics) override;
310 310
311 private: 311 private:
312 mojom::CursorType* cursor_storage_; 312 ui::CursorData* cursor_storage_;
313 313
314 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory); 314 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory);
315 }; 315 };
316 316
317 // ----------------------------------------------------------------------------- 317 // -----------------------------------------------------------------------------
318 318
319 class TestWindowManager : public mojom::WindowManager { 319 class TestWindowManager : public mojom::WindowManager {
320 public: 320 public:
321 TestWindowManager(); 321 TestWindowManager();
322 ~TestWindowManager() override; 322 ~TestWindowManager() override;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 const base::Optional<std::vector<uint8_t>>& new_data) override; 483 const base::Optional<std::vector<uint8_t>>& new_data) override;
484 void OnWindowInputEvent(uint32_t event_id, 484 void OnWindowInputEvent(uint32_t event_id,
485 uint32_t window, 485 uint32_t window,
486 int64_t display_id, 486 int64_t display_id,
487 std::unique_ptr<ui::Event> event, 487 std::unique_ptr<ui::Event> event,
488 bool matches_pointer_watcher) override; 488 bool matches_pointer_watcher) override;
489 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, 489 void OnPointerEventObserved(std::unique_ptr<ui::Event> event,
490 uint32_t window_id, 490 uint32_t window_id,
491 int64_t display_id) override; 491 int64_t display_id) override;
492 void OnWindowFocused(uint32_t focused_window_id) override; 492 void OnWindowFocused(uint32_t focused_window_id) override;
493 void OnWindowPredefinedCursorChanged(uint32_t window_id, 493 void OnWindowCursorChanged(uint32_t window_id,
494 mojom::CursorType cursor_id) override; 494 ui::CursorData cursor) override;
495 void OnWindowSurfaceChanged(Id window_id, 495 void OnWindowSurfaceChanged(Id window_id,
496 const cc::SurfaceInfo& surface_info) override; 496 const cc::SurfaceInfo& surface_info) override;
497 void OnDragDropStart( 497 void OnDragDropStart(
498 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) 498 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
499 override; 499 override;
500 void OnDragEnter(uint32_t window, 500 void OnDragEnter(uint32_t window,
501 uint32_t key_state, 501 uint32_t key_state,
502 const gfx::Point& position, 502 const gfx::Point& position,
503 uint32_t effect_bitmask, 503 uint32_t effect_bitmask,
504 const OnDragEnterCallback& callback) override; 504 const OnDragEnterCallback& callback) override;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 // ----------------------------------------------------------------------------- 615 // -----------------------------------------------------------------------------
616 616
617 // Helper class which creates and sets up the necessary objects for tests that 617 // Helper class which creates and sets up the necessary objects for tests that
618 // use the WindowServer. 618 // use the WindowServer.
619 class WindowServerTestHelper { 619 class WindowServerTestHelper {
620 public: 620 public:
621 WindowServerTestHelper(); 621 WindowServerTestHelper();
622 ~WindowServerTestHelper(); 622 ~WindowServerTestHelper();
623 623
624 WindowServer* window_server() { return window_server_.get(); } 624 WindowServer* window_server() { return window_server_.get(); }
625 mojom::CursorType cursor() const { return cursor_id_; } 625 ui::CursorData cursor() const { return cursor_; }
626 626
627 TestWindowServerDelegate* window_server_delegate() { 627 TestWindowServerDelegate* window_server_delegate() {
628 return &window_server_delegate_; 628 return &window_server_delegate_;
629 } 629 }
630 630
631 private: 631 private:
632 mojom::CursorType cursor_id_; 632 ui::CursorData cursor_;
633 TestPlatformDisplayFactory platform_display_factory_; 633 TestPlatformDisplayFactory platform_display_factory_;
634 TestWindowServerDelegate window_server_delegate_; 634 TestWindowServerDelegate window_server_delegate_;
635 std::unique_ptr<WindowServer> window_server_; 635 std::unique_ptr<WindowServer> window_server_;
636 std::unique_ptr<base::MessageLoop> message_loop_; 636 std::unique_ptr<base::MessageLoop> message_loop_;
637 637
638 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper); 638 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper);
639 }; 639 };
640 640
641 // ----------------------------------------------------------------------------- 641 // -----------------------------------------------------------------------------
642 642
(...skipping 15 matching lines...) Expand all
658 // |window_bounds|. 658 // |window_bounds|.
659 // TODO(sky): rename and cleanup. This doesn't really create a new tree. 659 // TODO(sky): rename and cleanup. This doesn't really create a new tree.
660 void CreateSecondaryTree(ServerWindow* embed_window, 660 void CreateSecondaryTree(ServerWindow* embed_window,
661 const gfx::Rect& window_bounds, 661 const gfx::Rect& window_bounds,
662 TestWindowTreeClient** out_client, 662 TestWindowTreeClient** out_client,
663 WindowTree** window_tree, 663 WindowTree** window_tree,
664 ServerWindow** window); 664 ServerWindow** window);
665 // Sets the task runner for |message_loop_| 665 // Sets the task runner for |message_loop_|
666 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); 666 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
667 667
668 mojom::CursorType cursor() const { return ws_test_helper_.cursor(); } 668 ui::CursorType cursor_type() const {
669 return ws_test_helper_.cursor().cursor_type();
670 }
669 Display* display() { return display_; } 671 Display* display() { return display_; }
670 TestWindowTreeBinding* last_binding() { 672 TestWindowTreeBinding* last_binding() {
671 return ws_test_helper_.window_server_delegate()->last_binding(); 673 return ws_test_helper_.window_server_delegate()->last_binding();
672 } 674 }
673 TestWindowTreeClient* last_window_tree_client() { 675 TestWindowTreeClient* last_window_tree_client() {
674 return ws_test_helper_.window_server_delegate()->last_client(); 676 return ws_test_helper_.window_server_delegate()->last_client();
675 } 677 }
676 TestWindowTreeClient* wm_client() { return wm_client_; } 678 TestWindowTreeClient* wm_client() { return wm_client_; }
677 WindowServer* window_server() { return ws_test_helper_.window_server(); } 679 WindowServer* window_server() { return ws_test_helper_.window_server(); }
678 680
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 ClientWindowId* client_id = nullptr); 727 ClientWindowId* client_id = nullptr);
726 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 728 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
727 ServerWindow* parent, 729 ServerWindow* parent,
728 ClientWindowId* client_id = nullptr); 730 ClientWindowId* client_id = nullptr);
729 731
730 } // namespace test 732 } // namespace test
731 } // namespace ws 733 } // namespace ws
732 } // namespace ui 734 } // namespace ui
733 735
734 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 736 #endif // SERVICES_UI_WS_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « services/ui/ws/test_change_tracker.cc ('k') | services/ui/ws/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698