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

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

Issue 2784663003: mus: Rename mojom::Cursor to mojom::CursorType. (Closed)
Patch Set: Created 3 years, 8 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 // ----------------------------------------------------------------------------- 136 // -----------------------------------------------------------------------------
137 137
138 class DisplayTestApi { 138 class DisplayTestApi {
139 public: 139 public:
140 explicit DisplayTestApi(Display* display); 140 explicit DisplayTestApi(Display* display);
141 ~DisplayTestApi(); 141 ~DisplayTestApi();
142 142
143 void OnEvent(ui::Event* event) { display_->OnEventFromSource(event); } 143 void OnEvent(ui::Event* event) { display_->OnEventFromSource(event); }
144 144
145 mojom::Cursor last_cursor() const { return display_->last_cursor_; } 145 mojom::CursorType last_cursor() const { return display_->last_cursor_; }
146 146
147 private: 147 private:
148 Display* display_; 148 Display* display_;
149 149
150 DISALLOW_COPY_AND_ASSIGN(DisplayTestApi); 150 DISALLOW_COPY_AND_ASSIGN(DisplayTestApi);
151 }; 151 };
152 152
153 // ----------------------------------------------------------------------------- 153 // -----------------------------------------------------------------------------
154 154
155 class EventDispatcherTestApi { 155 class EventDispatcherTestApi {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 WindowServer* window_server_; 268 WindowServer* window_server_;
269 269
270 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding); 270 DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding);
271 }; 271 };
272 272
273 // ----------------------------------------------------------------------------- 273 // -----------------------------------------------------------------------------
274 274
275 // Factory that dispenses TestPlatformDisplays. 275 // Factory that dispenses TestPlatformDisplays.
276 class TestPlatformDisplayFactory : public PlatformDisplayFactory { 276 class TestPlatformDisplayFactory : public PlatformDisplayFactory {
277 public: 277 public:
278 explicit TestPlatformDisplayFactory(mojom::Cursor* cursor_storage); 278 explicit TestPlatformDisplayFactory(mojom::CursorType* cursor_storage);
279 ~TestPlatformDisplayFactory(); 279 ~TestPlatformDisplayFactory();
280 280
281 // PlatformDisplayFactory: 281 // PlatformDisplayFactory:
282 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay( 282 std::unique_ptr<PlatformDisplay> CreatePlatformDisplay(
283 ServerWindow* root_window, 283 ServerWindow* root_window,
284 const display::ViewportMetrics& metrics) override; 284 const display::ViewportMetrics& metrics) override;
285 285
286 private: 286 private:
287 mojom::Cursor* cursor_storage_; 287 mojom::CursorType* cursor_storage_;
288 288
289 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory); 289 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory);
290 }; 290 };
291 291
292 // ----------------------------------------------------------------------------- 292 // -----------------------------------------------------------------------------
293 293
294 class TestWindowManager : public mojom::WindowManager { 294 class TestWindowManager : public mojom::WindowManager {
295 public: 295 public:
296 TestWindowManager() 296 TestWindowManager()
297 : got_create_top_level_window_(false), 297 : got_create_top_level_window_(false),
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 void OnWindowInputEvent(uint32_t event_id, 452 void OnWindowInputEvent(uint32_t event_id,
453 uint32_t window, 453 uint32_t window,
454 int64_t display_id, 454 int64_t display_id,
455 std::unique_ptr<ui::Event> event, 455 std::unique_ptr<ui::Event> event,
456 bool matches_pointer_watcher) override; 456 bool matches_pointer_watcher) override;
457 void OnPointerEventObserved(std::unique_ptr<ui::Event> event, 457 void OnPointerEventObserved(std::unique_ptr<ui::Event> event,
458 uint32_t window_id, 458 uint32_t window_id,
459 int64_t display_id) override; 459 int64_t display_id) override;
460 void OnWindowFocused(uint32_t focused_window_id) override; 460 void OnWindowFocused(uint32_t focused_window_id) override;
461 void OnWindowPredefinedCursorChanged(uint32_t window_id, 461 void OnWindowPredefinedCursorChanged(uint32_t window_id,
462 mojom::Cursor cursor_id) override; 462 mojom::CursorType cursor_id) override;
463 void OnWindowSurfaceChanged(Id window_id, 463 void OnWindowSurfaceChanged(Id window_id,
464 const cc::SurfaceInfo& surface_info) override; 464 const cc::SurfaceInfo& surface_info) override;
465 void OnDragDropStart( 465 void OnDragDropStart(
466 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) 466 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data)
467 override; 467 override;
468 void OnDragEnter(uint32_t window, 468 void OnDragEnter(uint32_t window,
469 uint32_t key_state, 469 uint32_t key_state,
470 const gfx::Point& position, 470 const gfx::Point& position,
471 uint32_t effect_bitmask, 471 uint32_t effect_bitmask,
472 const OnDragEnterCallback& callback) override; 472 const OnDragEnterCallback& callback) override;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // ----------------------------------------------------------------------------- 583 // -----------------------------------------------------------------------------
584 584
585 // Helper class which creates and sets up the necessary objects for tests that 585 // Helper class which creates and sets up the necessary objects for tests that
586 // use the WindowServer. 586 // use the WindowServer.
587 class WindowServerTestHelper { 587 class WindowServerTestHelper {
588 public: 588 public:
589 WindowServerTestHelper(); 589 WindowServerTestHelper();
590 ~WindowServerTestHelper(); 590 ~WindowServerTestHelper();
591 591
592 WindowServer* window_server() { return window_server_.get(); } 592 WindowServer* window_server() { return window_server_.get(); }
593 mojom::Cursor cursor() const { return cursor_id_; } 593 mojom::CursorType cursor() const { return cursor_id_; }
594 594
595 TestWindowServerDelegate* window_server_delegate() { 595 TestWindowServerDelegate* window_server_delegate() {
596 return &window_server_delegate_; 596 return &window_server_delegate_;
597 } 597 }
598 598
599 private: 599 private:
600 mojom::Cursor cursor_id_; 600 mojom::CursorType cursor_id_;
601 TestPlatformDisplayFactory platform_display_factory_; 601 TestPlatformDisplayFactory platform_display_factory_;
602 TestWindowServerDelegate window_server_delegate_; 602 TestWindowServerDelegate window_server_delegate_;
603 std::unique_ptr<WindowServer> window_server_; 603 std::unique_ptr<WindowServer> window_server_;
604 std::unique_ptr<base::MessageLoop> message_loop_; 604 std::unique_ptr<base::MessageLoop> message_loop_;
605 605
606 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper); 606 DISALLOW_COPY_AND_ASSIGN(WindowServerTestHelper);
607 }; 607 };
608 608
609 // ----------------------------------------------------------------------------- 609 // -----------------------------------------------------------------------------
610 610
(...skipping 14 matching lines...) Expand all
625 // |window_bounds|. 625 // |window_bounds|.
626 // TODO(sky): rename and cleanup. This doesn't really create a new tree. 626 // TODO(sky): rename and cleanup. This doesn't really create a new tree.
627 void CreateSecondaryTree(ServerWindow* embed_window, 627 void CreateSecondaryTree(ServerWindow* embed_window,
628 const gfx::Rect& window_bounds, 628 const gfx::Rect& window_bounds,
629 TestWindowTreeClient** out_client, 629 TestWindowTreeClient** out_client,
630 WindowTree** window_tree, 630 WindowTree** window_tree,
631 ServerWindow** window); 631 ServerWindow** window);
632 // Sets the task runner for |message_loop_| 632 // Sets the task runner for |message_loop_|
633 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner); 633 void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
634 634
635 mojom::Cursor cursor() const { return ws_test_helper_.cursor(); } 635 mojom::CursorType cursor() const { return ws_test_helper_.cursor(); }
636 Display* display() { return display_; } 636 Display* display() { return display_; }
637 TestWindowTreeBinding* last_binding() { 637 TestWindowTreeBinding* last_binding() {
638 return ws_test_helper_.window_server_delegate()->last_binding(); 638 return ws_test_helper_.window_server_delegate()->last_binding();
639 } 639 }
640 TestWindowTreeClient* last_window_tree_client() { 640 TestWindowTreeClient* last_window_tree_client() {
641 return ws_test_helper_.window_server_delegate()->last_client(); 641 return ws_test_helper_.window_server_delegate()->last_client();
642 } 642 }
643 TestWindowTreeClient* wm_client() { return wm_client_; } 643 TestWindowTreeClient* wm_client() { return wm_client_; }
644 WindowServer* window_server() { return ws_test_helper_.window_server(); } 644 WindowServer* window_server() { return ws_test_helper_.window_server(); }
645 645
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id); 689 ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
690 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree, 690 ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
691 ServerWindow* parent, 691 ServerWindow* parent,
692 ClientWindowId* client_id = nullptr); 692 ClientWindowId* client_id = nullptr);
693 693
694 } // namespace test 694 } // namespace test
695 } // namespace ws 695 } // namespace ws
696 } // namespace ui 696 } // namespace ui
697 697
698 #endif // SERVICES_UI_WS_TEST_UTILS_H_ 698 #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