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

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

Issue 2008193002: Change mojo geometry structs from using type converters to StructTraits. (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
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 "mojo/converters/geometry/geometry_type_converters.h"
15 #include "services/shell/public/interfaces/connector.mojom.h" 14 #include "services/shell/public/interfaces/connector.mojom.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 16
18 namespace mus { 17 namespace mus {
19 namespace ws { 18 namespace ws {
20 namespace test { 19 namespace test {
21 namespace { 20 namespace {
22 21
23 // ----------------------------------------------------------------------------- 22 // -----------------------------------------------------------------------------
24 // Empty implementation of PlatformDisplay. 23 // Empty implementation of PlatformDisplay.
25 class TestPlatformDisplay : public PlatformDisplay { 24 class TestPlatformDisplay : public PlatformDisplay {
26 public: 25 public:
27 explicit TestPlatformDisplay(int32_t* cursor_id_storage) 26 explicit TestPlatformDisplay(int32_t* cursor_id_storage)
28 : cursor_id_storage_(cursor_id_storage) { 27 : cursor_id_storage_(cursor_id_storage) {
29 display_metrics_.size_in_pixels = mojo::Size::From(gfx::Size(400, 300)); 28 display_metrics_.size_in_pixels = gfx::Size(400, 300);
30 display_metrics_.device_pixel_ratio = 1.f; 29 display_metrics_.device_pixel_ratio = 1.f;
31 } 30 }
32 ~TestPlatformDisplay() override {} 31 ~TestPlatformDisplay() override {}
33 32
34 // PlatformDisplay: 33 // PlatformDisplay:
35 void Init(PlatformDisplayDelegate* delegate) override { 34 void Init(PlatformDisplayDelegate* delegate) override {
36 // It is necessary to tell the delegate about the ViewportMetrics to make 35 // It is necessary to tell the delegate about the ViewportMetrics to make
37 // sure that the DisplayBinding is correctly initialized (and a root-window 36 // sure that the DisplayBinding is correctly initialized (and a root-window
38 // is created). 37 // is created).
39 delegate->OnViewportMetricsChanged(mojom::ViewportMetrics(), 38 delegate->OnViewportMetricsChanged(mojom::ViewportMetrics(),
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 197
199 void TestWindowTreeClient::OnLostCapture(Id window_id) {} 198 void TestWindowTreeClient::OnLostCapture(Id window_id) {}
200 199
201 void TestWindowTreeClient::OnTopLevelCreated(uint32_t change_id, 200 void TestWindowTreeClient::OnTopLevelCreated(uint32_t change_id,
202 mojom::WindowDataPtr data, 201 mojom::WindowDataPtr data,
203 bool drawn) { 202 bool drawn) {
204 tracker_.OnTopLevelCreated(change_id, std::move(data), drawn); 203 tracker_.OnTopLevelCreated(change_id, std::move(data), drawn);
205 } 204 }
206 205
207 void TestWindowTreeClient::OnWindowBoundsChanged(uint32_t window, 206 void TestWindowTreeClient::OnWindowBoundsChanged(uint32_t window,
208 mojo::RectPtr old_bounds, 207 const gfx::Rect& old_bounds,
209 mojo::RectPtr new_bounds) { 208 const gfx::Rect& new_bounds) {
210 tracker_.OnWindowBoundsChanged(window, std::move(old_bounds), 209 tracker_.OnWindowBoundsChanged(window, std::move(old_bounds),
211 std::move(new_bounds)); 210 std::move(new_bounds));
212 } 211 }
213 212
214 void TestWindowTreeClient::OnClientAreaChanged( 213 void TestWindowTreeClient::OnClientAreaChanged(
215 uint32_t window_id, 214 uint32_t window_id,
216 mojo::InsetsPtr new_client_area, 215 const gfx::Insets& new_client_area,
217 mojo::Array<mojo::RectPtr> new_additional_client_areas) {} 216 mojo::Array<gfx::Rect> new_additional_client_areas) {}
218 217
219 void TestWindowTreeClient::OnTransientWindowAdded( 218 void TestWindowTreeClient::OnTransientWindowAdded(
220 uint32_t window_id, 219 uint32_t window_id,
221 uint32_t transient_window_id) {} 220 uint32_t transient_window_id) {}
222 221
223 void TestWindowTreeClient::OnTransientWindowRemoved( 222 void TestWindowTreeClient::OnTransientWindowRemoved(
224 uint32_t window_id, 223 uint32_t window_id,
225 uint32_t transient_window_id) {} 224 uint32_t transient_window_id) {}
226 225
227 void TestWindowTreeClient::OnWindowViewportMetricsChanged( 226 void TestWindowTreeClient::OnWindowViewportMetricsChanged(
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 return nullptr; 492 return nullptr;
494 if (!tree->AddWindow(parent_client_id, client_window_id)) 493 if (!tree->AddWindow(parent_client_id, client_window_id))
495 return nullptr; 494 return nullptr;
496 *client_id = client_window_id; 495 *client_id = client_window_id;
497 return tree->GetWindowByClientId(client_window_id); 496 return tree->GetWindowByClientId(client_window_id);
498 } 497 }
499 498
500 } // namespace test 499 } // namespace test
501 } // namespace ws 500 } // namespace ws
502 } // namespace mus 501 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698