| 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 void RequestCopyOfOutput( | 60 void RequestCopyOfOutput( |
| 67 std::unique_ptr<cc::CopyOutputRequest> output_request) override {} | 61 std::unique_ptr<cc::CopyOutputRequest> output_request) override {} |
| 68 gfx::Rect GetBounds() const override { return display_metrics_.bounds; } | 62 gfx::Rect GetBounds() const override { return display_metrics_.bounds; } |
| 63 bool UpdateViewportMetrics(const display::ViewportMetrics& metrics) override { |
| 64 if (display_metrics_ == metrics) |
| 65 return false; |
| 66 display_metrics_ = metrics; |
| 67 return true; |
| 68 } |
| 69 const display::ViewportMetrics& GetViewportMetrics() const override { |
| 70 return display_metrics_; |
| 71 } |
| 69 bool IsPrimaryDisplay() const override { return is_primary_; } | 72 bool IsPrimaryDisplay() const override { return is_primary_; } |
| 70 void OnGpuChannelEstablished( | 73 void OnGpuChannelEstablished( |
| 71 scoped_refptr<gpu::GpuChannelHost> host) override {} | 74 scoped_refptr<gpu::GpuChannelHost> host) override {} |
| 72 | 75 |
| 73 private: | 76 private: |
| 74 ViewportMetrics display_metrics_; | 77 display::ViewportMetrics display_metrics_; |
| 75 | 78 |
| 76 int64_t id_; | 79 int64_t id_; |
| 77 bool is_primary_; | 80 bool is_primary_; |
| 78 mojom::Cursor* cursor_storage_; | 81 mojom::Cursor* cursor_storage_; |
| 79 | 82 |
| 80 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); | 83 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); |
| 81 }; | 84 }; |
| 82 | 85 |
| 83 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { | 86 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { |
| 84 ClientWindowId client_id; | 87 ClientWindowId client_id; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 TestFrameGeneratorDelegate::~TestFrameGeneratorDelegate() {} | 140 TestFrameGeneratorDelegate::~TestFrameGeneratorDelegate() {} |
| 138 | 141 |
| 139 ServerWindow* TestFrameGeneratorDelegate::GetRootWindow() { | 142 ServerWindow* TestFrameGeneratorDelegate::GetRootWindow() { |
| 140 return root_.get(); | 143 return root_.get(); |
| 141 } | 144 } |
| 142 | 145 |
| 143 bool TestFrameGeneratorDelegate::IsInHighContrastMode() { | 146 bool TestFrameGeneratorDelegate::IsInHighContrastMode() { |
| 144 return false; | 147 return false; |
| 145 } | 148 } |
| 146 | 149 |
| 147 const ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() { | 150 const display::ViewportMetrics& TestFrameGeneratorDelegate::GetViewportMetrics() |
| 151 const { |
| 148 return metrics_; | 152 return metrics_; |
| 149 } | 153 } |
| 150 | 154 |
| 151 // WindowTreeTestApi --------------------------------------------------------- | 155 // WindowTreeTestApi --------------------------------------------------------- |
| 152 | 156 |
| 153 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} | 157 WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {} |
| 154 WindowTreeTestApi::~WindowTreeTestApi() {} | 158 WindowTreeTestApi::~WindowTreeTestApi() {} |
| 155 | 159 |
| 156 void WindowTreeTestApi::StartPointerWatcher(bool want_moves) { | 160 void WindowTreeTestApi::StartPointerWatcher(bool want_moves) { |
| 157 tree_->StartPointerWatcher(want_moves); | 161 tree_->StartPointerWatcher(want_moves); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 return nullptr; | 612 return nullptr; |
| 609 if (!tree->AddWindow(parent_client_id, client_window_id)) | 613 if (!tree->AddWindow(parent_client_id, client_window_id)) |
| 610 return nullptr; | 614 return nullptr; |
| 611 *client_id = client_window_id; | 615 *client_id = client_window_id; |
| 612 return tree->GetWindowByClientId(client_window_id); | 616 return tree->GetWindowByClientId(client_window_id); |
| 613 } | 617 } |
| 614 | 618 |
| 615 } // namespace test | 619 } // namespace test |
| 616 } // namespace ws | 620 } // namespace ws |
| 617 } // namespace ui | 621 } // namespace ui |
| OLD | NEW |