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 11 matching lines...) Expand all Loading... |
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(int32_t* cursor_id_storage) | 30 explicit TestPlatformDisplay(int32_t* cursor_id_storage) |
31 : cursor_id_storage_(cursor_id_storage) { | 31 : cursor_id_storage_(cursor_id_storage) { |
32 display_metrics_.size_in_pixels = gfx::Size(400, 300); | 32 display_metrics_.bounds = gfx::Rect(0, 0, 400, 300); |
33 display_metrics_.device_scale_factor = 1.f; | 33 display_metrics_.device_scale_factor = 1.f; |
34 } | 34 } |
35 ~TestPlatformDisplay() override {} | 35 ~TestPlatformDisplay() override {} |
36 | 36 |
37 // PlatformDisplay: | 37 // PlatformDisplay: |
38 void Init(PlatformDisplayDelegate* delegate) override { | 38 void Init(PlatformDisplayDelegate* delegate) override { |
39 // It is necessary to tell the delegate about the ViewportMetrics to make | 39 // It is necessary to tell the delegate about the ViewportMetrics to make |
40 // sure that the DisplayBinding is correctly initialized (and a root-window | 40 // sure that the DisplayBinding is correctly initialized (and a root-window |
41 // is created). | 41 // is created). |
42 delegate->OnViewportMetricsChanged(ViewportMetrics(), display_metrics_); | 42 delegate->OnViewportMetricsChanged(ViewportMetrics(), display_metrics_); |
(...skipping 10 matching lines...) Expand all Loading... |
53 } | 53 } |
54 float GetDeviceScaleFactor() override { | 54 float GetDeviceScaleFactor() override { |
55 return display_metrics_.device_scale_factor; | 55 return display_metrics_.device_scale_factor; |
56 } | 56 } |
57 void UpdateTextInputState(const ui::TextInputState& state) override {} | 57 void UpdateTextInputState(const ui::TextInputState& state) override {} |
58 void SetImeVisibility(bool visible) override {} | 58 void SetImeVisibility(bool visible) override {} |
59 bool IsFramePending() const override { return false; } | 59 bool IsFramePending() const override { return false; } |
60 void RequestCopyOfOutput( | 60 void RequestCopyOfOutput( |
61 std::unique_ptr<cc::CopyOutputRequest> output_request) override {} | 61 std::unique_ptr<cc::CopyOutputRequest> output_request) override {} |
62 int64_t GetDisplayId() const override { return 1; } | 62 int64_t GetDisplayId() const override { return 1; } |
| 63 gfx::Rect GetBounds() const override { return display_metrics_.bounds; } |
63 | 64 |
64 private: | 65 private: |
65 ViewportMetrics display_metrics_; | 66 ViewportMetrics display_metrics_; |
66 | 67 |
67 int32_t* cursor_id_storage_; | 68 int32_t* cursor_id_storage_; |
68 | 69 |
69 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); | 70 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); |
70 }; | 71 }; |
71 | 72 |
72 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { | 73 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 return nullptr; | 523 return nullptr; |
523 if (!tree->AddWindow(parent_client_id, client_window_id)) | 524 if (!tree->AddWindow(parent_client_id, client_window_id)) |
524 return nullptr; | 525 return nullptr; |
525 *client_id = client_window_id; | 526 *client_id = client_window_id; |
526 return tree->GetWindowByClientId(client_window_id); | 527 return tree->GetWindowByClientId(client_window_id); |
527 } | 528 } |
528 | 529 |
529 } // namespace test | 530 } // namespace test |
530 } // namespace ws | 531 } // namespace ws |
531 } // namespace ui | 532 } // namespace ui |
OLD | NEW |