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

Side by Side Diff: components/mus/ws/test_utils.cc

Issue 2021483002: mus: Remove ViewportMetrics from mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 | « components/mus/ws/platform_display_delegate.h ('k') | components/mus/ws/window_server.h » ('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 "components/mus/ws/test_utils.h" 5 #include "components/mus/ws/test_utils.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "components/mus/surfaces/surfaces_state.h" 9 #include "components/mus/surfaces/surfaces_state.h"
10 #include "components/mus/ws/display_binding.h" 10 #include "components/mus/ws/display_binding.h"
11 #include "components/mus/ws/server_window_surface_manager_test_api.h" 11 #include "components/mus/ws/server_window_surface_manager_test_api.h"
12 #include "components/mus/ws/window_manager_access_policy.h" 12 #include "components/mus/ws/window_manager_access_policy.h"
13 #include "components/mus/ws/window_manager_factory_service.h" 13 #include "components/mus/ws/window_manager_factory_service.h"
14 #include "services/shell/public/interfaces/connector.mojom.h" 14 #include "services/shell/public/interfaces/connector.mojom.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" 16 #include "ui/gfx/geometry/mojo/geometry_type_converters.h"
17 17
18 namespace mus { 18 namespace mus {
19 namespace ws { 19 namespace ws {
20 namespace test { 20 namespace test {
21 namespace { 21 namespace {
22 22
23 // ----------------------------------------------------------------------------- 23 // -----------------------------------------------------------------------------
24 // Empty implementation of PlatformDisplay. 24 // Empty implementation of PlatformDisplay.
25 class TestPlatformDisplay : public PlatformDisplay { 25 class TestPlatformDisplay : public PlatformDisplay {
26 public: 26 public:
27 explicit TestPlatformDisplay(int32_t* cursor_id_storage) 27 explicit TestPlatformDisplay(int32_t* cursor_id_storage)
28 : cursor_id_storage_(cursor_id_storage) { 28 : cursor_id_storage_(cursor_id_storage) {
29 display_metrics_.size_in_pixels = mojo::Size::From(gfx::Size(400, 300)); 29 display_metrics_.size_in_pixels = gfx::Size(400, 300);
30 display_metrics_.device_pixel_ratio = 1.f; 30 display_metrics_.device_scale_factor = 1.f;
31 } 31 }
32 ~TestPlatformDisplay() override {} 32 ~TestPlatformDisplay() override {}
33 33
34 // PlatformDisplay: 34 // PlatformDisplay:
35 void Init(PlatformDisplayDelegate* delegate) override { 35 void Init(PlatformDisplayDelegate* delegate) override {
36 // It is necessary to tell the delegate about the ViewportMetrics to make 36 // It is necessary to tell the delegate about the ViewportMetrics to make
37 // sure that the DisplayBinding is correctly initialized (and a root-window 37 // sure that the DisplayBinding is correctly initialized (and a root-window
38 // is created). 38 // is created).
39 delegate->OnViewportMetricsChanged(mojom::ViewportMetrics(), 39 delegate->OnViewportMetricsChanged(ViewportMetrics(), display_metrics_);
40 display_metrics_);
41 } 40 }
42 void SchedulePaint(const ServerWindow* window, 41 void SchedulePaint(const ServerWindow* window,
43 const gfx::Rect& bounds) override {} 42 const gfx::Rect& bounds) override {}
44 void SetViewportSize(const gfx::Size& size) override {} 43 void SetViewportSize(const gfx::Size& size) override {}
45 void SetTitle(const base::string16& title) override {} 44 void SetTitle(const base::string16& title) override {}
46 void SetCapture() override {} 45 void SetCapture() override {}
47 void ReleaseCapture() override {} 46 void ReleaseCapture() override {}
48 void SetCursorById(int32_t cursor) override { *cursor_id_storage_ = cursor; } 47 void SetCursorById(int32_t cursor) override { *cursor_id_storage_ = cursor; }
49 mojom::Rotation GetRotation() override { return mojom::Rotation::VALUE_0; } 48 mojom::Rotation GetRotation() override { return mojom::Rotation::VALUE_0; }
50 const mojom::ViewportMetrics& GetViewportMetrics() override { 49 float GetDeviceScaleFactor() override {
51 return display_metrics_; 50 return display_metrics_.device_scale_factor;
52 } 51 }
53 void UpdateTextInputState(const ui::TextInputState& state) override {} 52 void UpdateTextInputState(const ui::TextInputState& state) override {}
54 void SetImeVisibility(bool visible) override {} 53 void SetImeVisibility(bool visible) override {}
55 bool IsFramePending() const override { return false; } 54 bool IsFramePending() const override { return false; }
56 void RequestCopyOfOutput( 55 void RequestCopyOfOutput(
57 std::unique_ptr<cc::CopyOutputRequest> output_request) override {} 56 std::unique_ptr<cc::CopyOutputRequest> output_request) override {}
58 57
59 private: 58 private:
60 mojom::ViewportMetrics display_metrics_; 59 ViewportMetrics display_metrics_;
61 60
62 int32_t* cursor_id_storage_; 61 int32_t* cursor_id_storage_;
63 62
64 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); 63 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay);
65 }; 64 };
66 65
67 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { 66 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) {
68 ClientWindowId client_id; 67 ClientWindowId client_id;
69 for (ClientSpecificId id = 1;; ++id) { 68 for (ClientSpecificId id = 1;; ++id) {
70 // Used the id of the client in the upper bits to simplify things. 69 // Used the id of the client in the upper bits to simplify things.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 return nullptr; 484 return nullptr;
486 if (!tree->AddWindow(parent_client_id, client_window_id)) 485 if (!tree->AddWindow(parent_client_id, client_window_id))
487 return nullptr; 486 return nullptr;
488 *client_id = client_window_id; 487 *client_id = client_window_id;
489 return tree->GetWindowByClientId(client_window_id); 488 return tree->GetWindowByClientId(client_window_id);
490 } 489 }
491 490
492 } // namespace test 491 } // namespace test
493 } // namespace ws 492 } // namespace ws
494 } // namespace mus 493 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/platform_display_delegate.h ('k') | components/mus/ws/window_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698