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

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

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/test_utils.h ('k') | components/mus/ws/transient_windows_unittest.cc » ('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 "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
8 #include "components/mus/surfaces/surfaces_state.h" 9 #include "components/mus/surfaces/surfaces_state.h"
9 #include "components/mus/ws/display_binding.h" 10 #include "components/mus/ws/display_binding.h"
10 #include "components/mus/ws/window_manager_access_policy.h" 11 #include "components/mus/ws/window_manager_access_policy.h"
11 #include "components/mus/ws/window_manager_factory_service.h" 12 #include "components/mus/ws/window_manager_factory_service.h"
12 #include "mojo/converters/geometry/geometry_type_converters.h" 13 #include "mojo/converters/geometry/geometry_type_converters.h"
13 #include "services/shell/public/interfaces/connector.mojom.h" 14 #include "services/shell/public/interfaces/connector.mojom.h"
14 15
15 namespace mus { 16 namespace mus {
16 namespace ws { 17 namespace ws {
(...skipping 27 matching lines...) Expand all
44 void ReleaseCapture() override {} 45 void ReleaseCapture() override {}
45 void SetCursorById(int32_t cursor) override { *cursor_id_storage_ = cursor; } 46 void SetCursorById(int32_t cursor) override { *cursor_id_storage_ = cursor; }
46 mojom::Rotation GetRotation() override { return mojom::Rotation::VALUE_0; } 47 mojom::Rotation GetRotation() override { return mojom::Rotation::VALUE_0; }
47 const mojom::ViewportMetrics& GetViewportMetrics() override { 48 const mojom::ViewportMetrics& GetViewportMetrics() override {
48 return display_metrics_; 49 return display_metrics_;
49 } 50 }
50 void UpdateTextInputState(const ui::TextInputState& state) override {} 51 void UpdateTextInputState(const ui::TextInputState& state) override {}
51 void SetImeVisibility(bool visible) override {} 52 void SetImeVisibility(bool visible) override {}
52 bool IsFramePending() const override { return false; } 53 bool IsFramePending() const override { return false; }
53 void RequestCopyOfOutput( 54 void RequestCopyOfOutput(
54 scoped_ptr<cc::CopyOutputRequest> output_request) override {} 55 std::unique_ptr<cc::CopyOutputRequest> output_request) override {}
55 56
56 private: 57 private:
57 mojom::ViewportMetrics display_metrics_; 58 mojom::ViewportMetrics display_metrics_;
58 59
59 int32_t* cursor_id_storage_; 60 int32_t* cursor_id_storage_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay); 62 DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay);
62 }; 63 };
63 64
64 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) { 65 ClientWindowId NextUnusedClientWindowId(WindowTree* tree) {
(...skipping 13 matching lines...) Expand all
78 79
79 WindowManagerFactoryRegistryTestApi::WindowManagerFactoryRegistryTestApi( 80 WindowManagerFactoryRegistryTestApi::WindowManagerFactoryRegistryTestApi(
80 WindowManagerFactoryRegistry* registry) 81 WindowManagerFactoryRegistry* registry)
81 : registry_(registry) {} 82 : registry_(registry) {}
82 83
83 WindowManagerFactoryRegistryTestApi::~WindowManagerFactoryRegistryTestApi() {} 84 WindowManagerFactoryRegistryTestApi::~WindowManagerFactoryRegistryTestApi() {}
84 85
85 void WindowManagerFactoryRegistryTestApi::AddService( 86 void WindowManagerFactoryRegistryTestApi::AddService(
86 const UserId& user_id, 87 const UserId& user_id,
87 mojom::WindowManagerFactory* factory) { 88 mojom::WindowManagerFactory* factory) {
88 scoped_ptr<WindowManagerFactoryService> service_ptr( 89 std::unique_ptr<WindowManagerFactoryService> service_ptr(
89 new WindowManagerFactoryService(registry_, user_id)); 90 new WindowManagerFactoryService(registry_, user_id));
90 WindowManagerFactoryService* service = service_ptr.get(); 91 WindowManagerFactoryService* service = service_ptr.get();
91 registry_->AddServiceImpl(std::move(service_ptr)); 92 registry_->AddServiceImpl(std::move(service_ptr));
92 service->SetWindowManagerFactoryImpl(factory); 93 service->SetWindowManagerFactoryImpl(factory);
93 } 94 }
94 95
95 // TestPlatformDisplayFactory ------------------------------------------------- 96 // TestPlatformDisplayFactory -------------------------------------------------
96 97
97 TestPlatformDisplayFactory::TestPlatformDisplayFactory( 98 TestPlatformDisplayFactory::TestPlatformDisplayFactory(
98 int32_t* cursor_id_storage) 99 int32_t* cursor_id_storage)
(...skipping 24 matching lines...) Expand all
123 if (pair.second.window == window) 124 if (pair.second.window == window)
124 count++; 125 count++;
125 return count; 126 return count;
126 } 127 }
127 128
128 // TestDisplayBinding --------------------------------------------------------- 129 // TestDisplayBinding ---------------------------------------------------------
129 130
130 WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) { 131 WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) {
131 return window_server_->EmbedAtWindow( 132 return window_server_->EmbedAtWindow(
132 root, shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr(), 133 root, shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr(),
133 make_scoped_ptr(new WindowManagerAccessPolicy)); 134 base::WrapUnique(new WindowManagerAccessPolicy));
134 } 135 }
135 136
136 // TestWindowManager ---------------------------------------------------------- 137 // TestWindowManager ----------------------------------------------------------
137 138
138 void TestWindowManager::WmCreateTopLevelWindow( 139 void TestWindowManager::WmCreateTopLevelWindow(
139 uint32_t change_id, 140 uint32_t change_id,
140 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) { 141 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) {
141 got_create_top_level_window_ = true; 142 got_create_top_level_window_ = true;
142 change_id_ = change_id; 143 change_id_ = change_id;
143 } 144 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 // Display manages its own lifetime. 304 // Display manages its own lifetime.
304 Display* display = new Display(window_server_, PlatformDisplayInitParams()); 305 Display* display = new Display(window_server_, PlatformDisplayInitParams());
305 display->Init(nullptr); 306 display->Init(nullptr);
306 return display; 307 return display;
307 } 308 }
308 309
309 void TestWindowServerDelegate::OnNoMoreDisplays() { 310 void TestWindowServerDelegate::OnNoMoreDisplays() {
310 got_on_no_more_displays_ = true; 311 got_on_no_more_displays_ = true;
311 } 312 }
312 313
313 scoped_ptr<WindowTreeBinding> TestWindowServerDelegate::CreateWindowTreeBinding( 314 std::unique_ptr<WindowTreeBinding>
315 TestWindowServerDelegate::CreateWindowTreeBinding(
314 BindingType type, 316 BindingType type,
315 ws::WindowServer* window_server, 317 ws::WindowServer* window_server,
316 ws::WindowTree* tree, 318 ws::WindowTree* tree,
317 mojom::WindowTreeRequest* tree_request, 319 mojom::WindowTreeRequest* tree_request,
318 mojom::WindowTreeClientPtr* client) { 320 mojom::WindowTreeClientPtr* client) {
319 scoped_ptr<TestWindowTreeBinding> binding(new TestWindowTreeBinding(tree)); 321 std::unique_ptr<TestWindowTreeBinding> binding(
322 new TestWindowTreeBinding(tree));
320 bindings_.push_back(binding.get()); 323 bindings_.push_back(binding.get());
321 return std::move(binding); 324 return std::move(binding);
322 } 325 }
323 326
324 void TestWindowServerDelegate::CreateDefaultDisplays() { 327 void TestWindowServerDelegate::CreateDefaultDisplays() {
325 DCHECK(num_displays_to_create_); 328 DCHECK(num_displays_to_create_);
326 DCHECK(window_server_); 329 DCHECK(window_server_);
327 330
328 for (int i = 0; i < num_displays_to_create_; ++i) 331 for (int i = 0; i < num_displays_to_create_; ++i)
329 AddDisplay(); 332 AddDisplay();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 return nullptr; 370 return nullptr;
368 if (!tree->AddWindow(parent_client_id, client_window_id)) 371 if (!tree->AddWindow(parent_client_id, client_window_id))
369 return nullptr; 372 return nullptr;
370 *client_id = client_window_id; 373 *client_id = client_window_id;
371 return tree->GetWindowByClientId(client_window_id); 374 return tree->GetWindowByClientId(client_window_id);
372 } 375 }
373 376
374 } // namespace test 377 } // namespace test
375 } // namespace ws 378 } // namespace ws
376 } // namespace mus 379 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/test_utils.h ('k') | components/mus/ws/transient_windows_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698