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

Side by Side Diff: chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" 5 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 18 matching lines...) Expand all
29 bool create_settings_service) { 29 bool create_settings_service) {
30 Initialize(create_settings_service); 30 Initialize(create_settings_service);
31 } 31 }
32 32
33 ScopedCrosSettingsTestHelper::~ScopedCrosSettingsTestHelper() { 33 ScopedCrosSettingsTestHelper::~ScopedCrosSettingsTestHelper() {
34 RestoreProvider(); 34 RestoreProvider();
35 } 35 }
36 36
37 std::unique_ptr<FakeOwnerSettingsService> 37 std::unique_ptr<FakeOwnerSettingsService>
38 ScopedCrosSettingsTestHelper::CreateOwnerSettingsService(Profile* profile) { 38 ScopedCrosSettingsTestHelper::CreateOwnerSettingsService(Profile* profile) {
39 return base::WrapUnique(new FakeOwnerSettingsService( 39 return base::MakeUnique<FakeOwnerSettingsService>(
40 profile, new ownership::MockOwnerKeyUtil(), &stub_settings_provider_)); 40 profile, new ownership::MockOwnerKeyUtil(), &stub_settings_provider_);
41 } 41 }
42 42
43 void ScopedCrosSettingsTestHelper::ReplaceProvider(const std::string& path) { 43 void ScopedCrosSettingsTestHelper::ReplaceProvider(const std::string& path) {
44 CHECK(!real_settings_provider_); 44 CHECK(!real_settings_provider_);
45 // Swap out the DeviceSettingsProvider with our settings provider so we can 45 // Swap out the DeviceSettingsProvider with our settings provider so we can
46 // set values for the specified path. 46 // set values for the specified path.
47 CrosSettings* const cros_settings = CrosSettings::Get(); 47 CrosSettings* const cros_settings = CrosSettings::Get();
48 real_settings_provider_ = cros_settings->GetProvider(path); 48 real_settings_provider_ = cros_settings->GetProvider(path);
49 EXPECT_TRUE(real_settings_provider_); 49 EXPECT_TRUE(real_settings_provider_);
50 EXPECT_TRUE(cros_settings->RemoveSettingsProvider(real_settings_provider_)); 50 EXPECT_TRUE(cros_settings->RemoveSettingsProvider(real_settings_provider_));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 void ScopedCrosSettingsTestHelper::Initialize(bool create_settings_service) { 125 void ScopedCrosSettingsTestHelper::Initialize(bool create_settings_service) {
126 if (create_settings_service) { 126 if (create_settings_service) {
127 CHECK(!DeviceSettingsService::IsInitialized()); 127 CHECK(!DeviceSettingsService::IsInitialized());
128 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService()); 128 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService());
129 test_cros_settings_.reset(new ScopedTestCrosSettings()); 129 test_cros_settings_.reset(new ScopedTestCrosSettings());
130 } 130 }
131 } 131 }
132 132
133 } // namespace chromeos 133 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698