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

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

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_utils.h ('k') | services/ui/ws/window_manager_state.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 #include "services/ui/ws/test_utils.h" 5 #include "services/ui/ws/test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 10 matching lines...) Expand all
21 namespace ui { 21 namespace ui {
22 namespace ws { 22 namespace ws {
23 namespace test { 23 namespace test {
24 namespace { 24 namespace {
25 25
26 // ----------------------------------------------------------------------------- 26 // -----------------------------------------------------------------------------
27 // Empty implementation of PlatformDisplay. 27 // Empty implementation of PlatformDisplay.
28 class TestPlatformDisplay : public PlatformDisplay { 28 class TestPlatformDisplay : public PlatformDisplay {
29 public: 29 public:
30 explicit TestPlatformDisplay(const display::ViewportMetrics& metrics, 30 explicit TestPlatformDisplay(const display::ViewportMetrics& metrics,
31 mojom::Cursor* cursor_storage) 31 mojom::CursorType* cursor_storage)
32 : metrics_(metrics), cursor_storage_(cursor_storage) {} 32 : metrics_(metrics), cursor_storage_(cursor_storage) {}
33 ~TestPlatformDisplay() override {} 33 ~TestPlatformDisplay() override {}
34 34
35 // PlatformDisplay: 35 // PlatformDisplay:
36 void Init(PlatformDisplayDelegate* delegate) override { 36 void Init(PlatformDisplayDelegate* delegate) override {
37 delegate->OnAcceleratedWidgetAvailable(); 37 delegate->OnAcceleratedWidgetAvailable();
38 } 38 }
39 void SetViewportSize(const gfx::Size& size) override {} 39 void SetViewportSize(const gfx::Size& size) override {}
40 void SetTitle(const base::string16& title) override {} 40 void SetTitle(const base::string16& title) override {}
41 void SetCapture() override {} 41 void SetCapture() override {}
42 void ReleaseCapture() override {} 42 void ReleaseCapture() override {}
43 void SetCursorById(mojom::Cursor cursor) override { 43 void SetCursorById(mojom::CursorType cursor) override {
44 *cursor_storage_ = cursor; 44 *cursor_storage_ = cursor;
45 } 45 }
46 void UpdateTextInputState(const ui::TextInputState& state) override {} 46 void UpdateTextInputState(const ui::TextInputState& state) override {}
47 void SetImeVisibility(bool visible) override {} 47 void SetImeVisibility(bool visible) override {}
48 void UpdateViewportMetrics(const display::ViewportMetrics& metrics) override { 48 void UpdateViewportMetrics(const display::ViewportMetrics& metrics) override {
49 metrics_ = metrics; 49 metrics_ = metrics;
50 } 50 }
51 gfx::AcceleratedWidget GetAcceleratedWidget() const override { 51 gfx::AcceleratedWidget GetAcceleratedWidget() const override {
52 return gfx::kNullAcceleratedWidget; 52 return gfx::kNullAcceleratedWidget;
53 } 53 }
54 FrameGenerator* GetFrameGenerator() override { return nullptr; } 54 FrameGenerator* GetFrameGenerator() override { return nullptr; }
55 EventSink* GetEventSink() override { return nullptr; } 55 EventSink* GetEventSink() override { return nullptr; }
56 56
57 private: 57 private:
58 display::ViewportMetrics metrics_; 58 display::ViewportMetrics metrics_;
59 mojom::Cursor* cursor_storage_; 59 mojom::CursorType* cursor_storage_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); 61 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay);
62 }; 62 };
63 63
64 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { 64 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) {
65 ClientWindowId client_id; 65 ClientWindowId client_id;
66 for (ClientSpecificId id = 1;; ++id) { 66 for (ClientSpecificId id = 1;; ++id) {
67 // Used the id of the client in the upper bits to simplify things. 67 // Used the id of the client in the upper bits to simplify things.
68 const ClientWindowId client_id = 68 const ClientWindowId client_id =
69 ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), id))); 69 ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), id)));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Reset everything. 138 // Reset everything.
139 display_ids_.clear(); 139 display_ids_.clear();
140 display::Screen::SetScreenInstance(nullptr); 140 display::Screen::SetScreenInstance(nullptr);
141 screen_ = base::MakeUnique<display::ScreenBase>(); 141 screen_ = base::MakeUnique<display::ScreenBase>();
142 display::Screen::SetScreenInstance(screen_.get()); 142 display::Screen::SetScreenInstance(screen_.get());
143 } 143 }
144 144
145 // TestPlatformDisplayFactory ------------------------------------------------- 145 // TestPlatformDisplayFactory -------------------------------------------------
146 146
147 TestPlatformDisplayFactory::TestPlatformDisplayFactory( 147 TestPlatformDisplayFactory::TestPlatformDisplayFactory(
148 mojom::Cursor* cursor_storage) 148 mojom::CursorType* cursor_storage)
149 : cursor_storage_(cursor_storage) {} 149 : cursor_storage_(cursor_storage) {}
150 150
151 TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {} 151 TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {}
152 152
153 std::unique_ptr<PlatformDisplay> 153 std::unique_ptr<PlatformDisplay>
154 TestPlatformDisplayFactory::CreatePlatformDisplay( 154 TestPlatformDisplayFactory::CreatePlatformDisplay(
155 ServerWindow* root_window, 155 ServerWindow* root_window,
156 const display::ViewportMetrics& metrics) { 156 const display::ViewportMetrics& metrics) {
157 return base::MakeUnique<TestPlatformDisplay>(metrics, cursor_storage_); 157 return base::MakeUnique<TestPlatformDisplay>(metrics, cursor_storage_);
158 } 158 }
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 int64_t display_id) { 394 int64_t display_id) {
395 tracker_.OnPointerEventObserved(*event.get(), window_id); 395 tracker_.OnPointerEventObserved(*event.get(), window_id);
396 } 396 }
397 397
398 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) { 398 void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
399 tracker_.OnWindowFocused(focused_window_id); 399 tracker_.OnWindowFocused(focused_window_id);
400 } 400 }
401 401
402 void TestWindowTreeClient::OnWindowPredefinedCursorChanged( 402 void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
403 uint32_t window_id, 403 uint32_t window_id,
404 mojom::Cursor cursor_id) { 404 mojom::CursorType cursor_id) {
405 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); 405 tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
406 } 406 }
407 407
408 void TestWindowTreeClient::OnWindowSurfaceChanged( 408 void TestWindowTreeClient::OnWindowSurfaceChanged(
409 Id window_id, 409 Id window_id,
410 const cc::SurfaceInfo& surface_info) {} 410 const cc::SurfaceInfo& surface_info) {}
411 411
412 void TestWindowTreeClient::OnDragDropStart( 412 void TestWindowTreeClient::OnDragDropStart(
413 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) {} 413 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) {}
414 414
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return std::move(binding); 499 return std::move(binding);
500 } 500 }
501 501
502 bool TestWindowServerDelegate::IsTestConfig() const { 502 bool TestWindowServerDelegate::IsTestConfig() const {
503 return true; 503 return true;
504 } 504 }
505 505
506 // WindowServerTestHelper --------------------------------------------------- 506 // WindowServerTestHelper ---------------------------------------------------
507 507
508 WindowServerTestHelper::WindowServerTestHelper() 508 WindowServerTestHelper::WindowServerTestHelper()
509 : cursor_id_(mojom::Cursor::CURSOR_NULL), 509 : cursor_id_(mojom::CursorType::CURSOR_NULL),
510 platform_display_factory_(&cursor_id_) { 510 platform_display_factory_(&cursor_id_) {
511 // Some tests create their own message loop, for example to add a task runner. 511 // Some tests create their own message loop, for example to add a task runner.
512 if (!base::MessageLoop::current()) 512 if (!base::MessageLoop::current())
513 message_loop_ = base::MakeUnique<base::MessageLoop>(); 513 message_loop_ = base::MakeUnique<base::MessageLoop>();
514 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); 514 PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
515 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_); 515 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_);
516 window_server_delegate_.set_window_server(window_server_.get()); 516 window_server_delegate_.set_window_server(window_server_.get());
517 } 517 }
518 518
519 WindowServerTestHelper::~WindowServerTestHelper() { 519 WindowServerTestHelper::~WindowServerTestHelper() {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 if (!tree->AddWindow(parent_client_id, client_window_id)) 662 if (!tree->AddWindow(parent_client_id, client_window_id))
663 return nullptr; 663 return nullptr;
664 if (client_id) 664 if (client_id)
665 *client_id = client_window_id; 665 *client_id = client_window_id;
666 return tree->GetWindowByClientId(client_window_id); 666 return tree->GetWindowByClientId(client_window_id);
667 } 667 }
668 668
669 } // namespace test 669 } // namespace test
670 } // namespace ws 670 } // namespace ws
671 } // namespace ui 671 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698