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

Side by Side Diff: components/sync/device_info/device_info_data_type_controller_unittest.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sync/device_info/device_info_data_type_controller.h" 5 #include "components/sync/device_info/device_info_data_type_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "components/sync/base/model_type.h" 13 #include "components/sync/base/model_type.h"
13 #include "components/sync/device_info/local_device_info_provider_mock.h" 14 #include "components/sync/device_info/local_device_info_provider_mock.h"
14 #include "components/sync/driver/fake_sync_client.h" 15 #include "components/sync/driver/fake_sync_client.h"
15 #include "components/sync/driver/sync_api_component_factory.h" 16 #include "components/sync/driver/sync_api_component_factory.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace syncer { 19 namespace syncer {
19 20
20 namespace { 21 namespace {
21 22
22 class DeviceInfoDataTypeControllerTest : public testing::Test { 23 class DeviceInfoDataTypeControllerTest : public testing::Test {
23 public: 24 public:
24 DeviceInfoDataTypeControllerTest() 25 DeviceInfoDataTypeControllerTest()
25 : load_finished_(false), 26 : load_finished_(false),
26 last_type_(UNSPECIFIED), 27 last_type_(UNSPECIFIED),
27 weak_ptr_factory_(this) {} 28 weak_ptr_factory_(this) {}
28 ~DeviceInfoDataTypeControllerTest() override {} 29 ~DeviceInfoDataTypeControllerTest() override {}
29 30
30 void SetUp() override { 31 void SetUp() override {
31 local_device_.reset(new LocalDeviceInfoProviderMock( 32 local_device_ = base::MakeUnique<LocalDeviceInfoProviderMock>(
32 "cache_guid", "Wayne Gretzky's Hacking Box", "Chromium 10k", 33 "cache_guid", "Wayne Gretzky's Hacking Box", "Chromium 10k",
33 "Chrome 10k", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id")); 34 "Chrome 10k", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id");
34 35
35 controller_.reset(new DeviceInfoDataTypeController( 36 controller_ = base::MakeUnique<DeviceInfoDataTypeController>(
36 base::Closure(), &sync_client_, local_device_.get())); 37 base::Closure(), &sync_client_, local_device_.get());
37 38
38 load_finished_ = false; 39 load_finished_ = false;
39 last_type_ = UNSPECIFIED; 40 last_type_ = UNSPECIFIED;
40 last_error_ = SyncError(); 41 last_error_ = SyncError();
41 } 42 }
42 43
43 void TearDown() override { 44 void TearDown() override {
44 controller_ = NULL; 45 controller_ = NULL;
45 local_device_.reset(); 46 local_device_.reset();
46 } 47 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 controller_->Stop(); 117 controller_->Stop();
117 // Destroy |local_device_| and |controller_| out of order 118 // Destroy |local_device_| and |controller_| out of order
118 // to verify that the controller doesn't crash in the destructor. 119 // to verify that the controller doesn't crash in the destructor.
119 local_device_.reset(); 120 local_device_.reset();
120 controller_ = NULL; 121 controller_ = NULL;
121 } 122 }
122 123
123 } // namespace 124 } // namespace
124 125
125 } // namespace syncer 126 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/base/proto_value_ptr_unittest.cc ('k') | components/sync/device_info/device_info_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698