Commit b92e241e authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Sync] Remove more instances of raw new.

This CL weeds out more instances of raw new and replaces them with
std::make_unique<>, wherever appropriate, per this guideline:
https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/c++-dos-and-donts.md#use-and-instead-of-bare

In one instance, there's no need of a pointer, so it's been removed.

Bug: 932591
Change-Id: I0b99d8ebc468bd7c496b7d50844f46fea2d68b44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1529090Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641686}
parent 4c1c5d88
......@@ -48,8 +48,9 @@ class BackgroundSyncControllerImplTest : public testing::Test {
protected:
BackgroundSyncControllerImplTest()
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
controller_(
new TestBackgroundSyncControllerImpl(&profile_, &rappor_service_)) {
controller_(std::make_unique<TestBackgroundSyncControllerImpl>(
&profile_,
&rappor_service_)) {
ResetFieldTrialList();
#if defined(OS_ANDROID)
BackgroundSyncLauncherAndroid::SetPlayServicesVersionCheckDisabledForTests(
......@@ -58,8 +59,8 @@ class BackgroundSyncControllerImplTest : public testing::Test {
}
void ResetFieldTrialList() {
field_trial_list_.reset(
new base::FieldTrialList(nullptr /* entropy provider */));
field_trial_list_ =
std::make_unique<base::FieldTrialList>(nullptr /* entropy provider */);
variations::testing::ClearAllVariationParams();
base::FieldTrialList::CreateFieldTrial(
BackgroundSyncControllerImpl::kFieldTrialName, kFieldTrialGroup);
......
......@@ -166,8 +166,8 @@ class BackgroundSyncBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
https_server_.reset(
new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
https_server_ = std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
https_server_->ServeFilesFromSourceDirectory("content/test/data");
ASSERT_TRUE(https_server_->Start());
......
......@@ -88,8 +88,7 @@ void ErrorAndRegistrationListCallback(
class BackgroundSyncServiceImplTest : public testing::Test {
public:
BackgroundSyncServiceImplTest()
: thread_bundle_(
new TestBrowserThreadBundle(TestBrowserThreadBundle::IO_MAINLOOP)) {
: thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {
default_sync_registration_ = blink::mojom::SyncRegistrationOptions::New();
}
......@@ -118,10 +117,10 @@ class BackgroundSyncServiceImplTest : public testing::Test {
// SetUp helper methods
void CreateTestHelper() {
embedded_worker_helper_.reset(
new EmbeddedWorkerTestHelper(base::FilePath()));
std::unique_ptr<MockPermissionManager> mock_permission_manager(
new testing::NiceMock<MockPermissionManager>());
embedded_worker_helper_ =
std::make_unique<EmbeddedWorkerTestHelper>((base::FilePath()));
std::unique_ptr<MockPermissionManager> mock_permission_manager =
std::make_unique<testing::NiceMock<MockPermissionManager>>();
ON_CALL(*mock_permission_manager,
GetPermissionStatus(PermissionType::BACKGROUND_SYNC, _, _))
.WillByDefault(
......@@ -211,7 +210,7 @@ class BackgroundSyncServiceImplTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
std::unique_ptr<TestBrowserThreadBundle> thread_bundle_;
TestBrowserThreadBundle thread_bundle_;
std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_;
std::unique_ptr<StoragePartitionImpl> storage_partition_impl_;
scoped_refptr<BackgroundSyncContextImpl> background_sync_context_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment