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

Side by Side Diff: ui/views/mus/platform_test_helper_mus.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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 | « ui/views/mus/native_widget_mus_unittest.cc ('k') | ui/views/mus/platform_window_mus.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 "ui/views/test/platform_test_helper.h"
6
7 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ptr_util.h"
8 #include "base/run_loop.h" 7 #include "base/run_loop.h"
9 #include "mojo/shell/background/background_shell.h" 8 #include "mojo/shell/background/background_shell.h"
10 #include "mojo/shell/background/tests/test_catalog_store.h" 9 #include "mojo/shell/background/tests/test_catalog_store.h"
11 #include "mojo/shell/public/cpp/connector.h" 10 #include "mojo/shell/public/cpp/connector.h"
12 #include "mojo/shell/public/cpp/shell_client.h" 11 #include "mojo/shell/public/cpp/shell_client.h"
13 #include "mojo/shell/public/cpp/shell_connection.h" 12 #include "mojo/shell/public/cpp/shell_connection.h"
14 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
15 #include "ui/views/mus/window_manager_connection.h" 14 #include "ui/views/mus/window_manager_connection.h"
15 #include "ui/views/test/platform_test_helper.h"
16 #include "ui/views/views_delegate.h" 16 #include "ui/views/views_delegate.h"
17 17
18 using mojo::shell::BackgroundShell; 18 using mojo::shell::BackgroundShell;
19 19
20 namespace views { 20 namespace views {
21 namespace { 21 namespace {
22 22
23 const char kTestName[] = "mojo:test-app"; 23 const char kTestName[] = "mojo:test-app";
24 24
25 class DefaultShellClient : public mojo::ShellClient { 25 class DefaultShellClient : public mojo::ShellClient {
26 public: 26 public:
27 DefaultShellClient() {} 27 DefaultShellClient() {}
28 ~DefaultShellClient() override {} 28 ~DefaultShellClient() override {}
29 29
30 private: 30 private:
31 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); 31 DISALLOW_COPY_AND_ASSIGN(DefaultShellClient);
32 }; 32 };
33 33
34 scoped_ptr<mojo::shell::TestCatalogStore> BuildTestCatalogStore() { 34 std::unique_ptr<mojo::shell::TestCatalogStore> BuildTestCatalogStore() {
35 scoped_ptr<base::ListValue> apps(new base::ListValue); 35 std::unique_ptr<base::ListValue> apps(new base::ListValue);
36 apps->Append( 36 apps->Append(
37 mojo::shell::BuildPermissiveSerializedAppInfo(kTestName, "test")); 37 mojo::shell::BuildPermissiveSerializedAppInfo(kTestName, "test"));
38 return make_scoped_ptr(new mojo::shell::TestCatalogStore(std::move(apps))); 38 return base::WrapUnique(new mojo::shell::TestCatalogStore(std::move(apps)));
39 } 39 }
40 40
41 class PlatformTestHelperMus : public PlatformTestHelper { 41 class PlatformTestHelperMus : public PlatformTestHelper {
42 public: 42 public:
43 PlatformTestHelperMus() { 43 PlatformTestHelperMus() {
44 background_shell_.reset(new BackgroundShell); 44 background_shell_.reset(new BackgroundShell);
45 scoped_ptr<BackgroundShell::InitParams> init_params( 45 std::unique_ptr<BackgroundShell::InitParams> init_params(
46 new BackgroundShell::InitParams); 46 new BackgroundShell::InitParams);
47 init_params->catalog_store = BuildTestCatalogStore(); 47 init_params->catalog_store = BuildTestCatalogStore();
48 background_shell_->Init(std::move(init_params)); 48 background_shell_->Init(std::move(init_params));
49 shell_client_.reset(new DefaultShellClient); 49 shell_client_.reset(new DefaultShellClient);
50 shell_connection_.reset(new mojo::ShellConnection( 50 shell_connection_.reset(new mojo::ShellConnection(
51 shell_client_.get(), 51 shell_client_.get(),
52 background_shell_->CreateShellClientRequest(kTestName))); 52 background_shell_->CreateShellClientRequest(kTestName)));
53 53
54 // TODO(rockot): Remove this RunLoop. http://crbug.com/594852. 54 // TODO(rockot): Remove this RunLoop. http://crbug.com/594852.
55 base::RunLoop wait_loop; 55 base::RunLoop wait_loop;
(...skipping 29 matching lines...) Expand all
85 internal::NativeWidgetDelegate* delegate) { 85 internal::NativeWidgetDelegate* delegate) {
86 ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory(); 86 ui::ContextFactory* factory = aura::Env::GetInstance()->context_factory();
87 aura::Env::GetInstance()->set_context_factory(nullptr); 87 aura::Env::GetInstance()->set_context_factory(nullptr);
88 NativeWidget* result = 88 NativeWidget* result =
89 WindowManagerConnection::Get()->CreateNativeWidgetMus( 89 WindowManagerConnection::Get()->CreateNativeWidgetMus(
90 props, init_params, delegate); 90 props, init_params, delegate);
91 aura::Env::GetInstance()->set_context_factory(factory); 91 aura::Env::GetInstance()->set_context_factory(factory);
92 return result; 92 return result;
93 } 93 }
94 94
95 scoped_ptr<BackgroundShell> background_shell_; 95 std::unique_ptr<BackgroundShell> background_shell_;
96 scoped_ptr<mojo::ShellConnection> shell_connection_; 96 std::unique_ptr<mojo::ShellConnection> shell_connection_;
97 scoped_ptr<DefaultShellClient> shell_client_; 97 std::unique_ptr<DefaultShellClient> shell_client_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus); 99 DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus);
100 }; 100 };
101 101
102 } // namespace 102 } // namespace
103 103
104 // static 104 // static
105 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { 105 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() {
106 return make_scoped_ptr(new PlatformTestHelperMus); 106 return base::WrapUnique(new PlatformTestHelperMus);
107 } 107 }
108 108
109 } // namespace views 109 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/native_widget_mus_unittest.cc ('k') | ui/views/mus/platform_window_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698