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 #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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 int64_t GetId() const override { return id_; } | 47 int64_t GetId() const override { return id_; } |
48 void SchedulePaint(const ServerWindow* window, | 48 void SchedulePaint(const ServerWindow* window, |
49 const gfx::Rect& bounds) override {} | 49 const gfx::Rect& bounds) override {} |
50 void SetViewportSize(const gfx::Size& size) override {} | 50 void SetViewportSize(const gfx::Size& size) override {} |
51 void SetTitle(const base::string16& title) override {} | 51 void SetTitle(const base::string16& title) override {} |
52 void SetCapture() override {} | 52 void SetCapture() override {} |
53 void ReleaseCapture() override {} | 53 void ReleaseCapture() override {} |
54 void SetCursorById(mojom::Cursor cursor) override { | 54 void SetCursorById(mojom::Cursor cursor) override { |
55 *cursor_storage_ = cursor; | 55 *cursor_storage_ = cursor; |
56 } | 56 } |
57 display::Display::Rotation GetRotation() override { | |
58 return display::Display::Rotation::ROTATE_0; | |
59 } | |
60 float GetDeviceScaleFactor() override { | |
61 return display_metrics_.device_scale_factor; | |
62 } | |
63 void UpdateTextInputState(const ui::TextInputState& state) override {} | 57 void UpdateTextInputState(const ui::TextInputState& state) override {} |
64 void SetImeVisibility(bool visible) override {} | 58 void SetImeVisibility(bool visible) override {} |
65 bool IsFramePending() const override { return false; } | 59 bool IsFramePending() const override { return false; } |
66 gfx::Rect GetBounds() const override { return display_metrics_.bounds; } | 60 gfx::Rect GetBounds() const override { return display_metrics_.bounds; } |
| 61 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override { |
| 62 if (display_metrics_ == metrics) |
| 63 return false; |
| 64 display_metrics_ = metrics; |
| 65 return true; |
| 66 } |
| 67 const display::ViewportMetrics& GetViewportMetrics() const override { |
| 68 return display_metrics_; |
| 69 } |
67 bool IsPrimaryDisplay() const override { return is_primary_; } | 70 bool IsPrimaryDisplay() const override { return is_primary_; } |
68 void OnGpuChannelEstablished( | 71 void OnGpuChannelEstablished( |
69 scoped_refptr<gpu::GpuChannelHost> host) override {} | 72 scoped_refptr<gpu::GpuChannelHost> host) override {} |
70 | 73 |
71 private: | 74 private: |
72 ViewportMetrics display_metrics_; | 75 display::ViewportMetrics display_metrics_; |
73 | 76 |
74 int64_t id_; | 77 int64_t id_; |
75 bool is_primary_; | 78 bool is_primary_; |
76 mojom::Cursor* cursor_storage_; | 79 mojom::Cursor* cursor_storage_; |
77 | 80 |
78 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); | 81 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); |
79 }; | 82 }; |
80 | 83 |
81 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { | 84 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { |
82 ClientWindowId client_id; | 85 ClientWindowId client_id; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 TestFrameGeneratorDelegate::~TestFrameGeneratorDelegate() {} | 138 TestFrameGeneratorDelegate::~TestFrameGeneratorDelegate() {} |
136 | 139 |
137 ServerWindow* TestFrameGeneratorDelegate::GetRootWindow() { | 140 ServerWindow* TestFrameGeneratorDelegate::GetRootWindow() { |
138 return root_.get(); | 141 return root_.get(); |
139 } | 142 } |
140 | 143 |
141 bool TestFrameGeneratorDelegate::IsInHighContrastMode() { | 144 bool TestFrameGeneratorDelegate::IsInHighContrastMode() { |
142 return false; | 145 return false; |
143 } | 146 } |
144 | 147 |
145 const ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() { | 148 const display::ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() |
| 149 const { |
146 return metrics_; | 150 return metrics_; |
147 } | 151 } |
148 | 152 |
149 // WindowTreeTestApi --------------------------------------------------------- | 153 // WindowTreeTestApi --------------------------------------------------------- |
150 | 154 |
151 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} | 155 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} |
152 WindowTreeTestApi::~WindowTreeTestApi() {} | 156 WindowTreeTestApi::~WindowTreeTestApi() {} |
153 | 157 |
154 void WindowTreeTestApi::StartPointerWatcher(bool want_moves) { | 158 void WindowTreeTestApi::StartPointerWatcher(bool want_moves) { |
155 tree_->StartPointerWatcher(want_moves); | 159 tree_->StartPointerWatcher(want_moves); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 return nullptr; | 610 return nullptr; |
607 if (!tree->AddWindow(parent_client_id, client_window_id)) | 611 if (!tree->AddWindow(parent_client_id, client_window_id)) |
608 return nullptr; | 612 return nullptr; |
609 *client_id = client_window_id; | 613 *client_id = client_window_id; |
610 return tree->GetWindowByClientId(client_window_id); | 614 return tree->GetWindowByClientId(client_window_id); |
611 } | 615 } |
612 | 616 |
613 } // namespace test | 617 } // namespace test |
614 } // namespace ws | 618 } // namespace ws |
615 } // namespace ui | 619 } // namespace ui |
OLD | NEW |