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

Side by Side Diff: components/storage_monitor/test_storage_monitor.cc

Issue 1884743002: Convert a few components from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint 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
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/storage_monitor/test_storage_monitor.h" 5 #include "components/storage_monitor/test_storage_monitor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 14 matching lines...) Expand all
25 media_transfer_protocol_manager_.reset( 25 media_transfer_protocol_manager_.reset(
26 new TestMediaTransferProtocolManagerLinux()); 26 new TestMediaTransferProtocolManagerLinux());
27 #endif 27 #endif
28 } 28 }
29 29
30 TestStorageMonitor::~TestStorageMonitor() {} 30 TestStorageMonitor::~TestStorageMonitor() {}
31 31
32 // static 32 // static
33 TestStorageMonitor* TestStorageMonitor::CreateAndInstall() { 33 TestStorageMonitor* TestStorageMonitor::CreateAndInstall() {
34 TestStorageMonitor* monitor = new TestStorageMonitor(); 34 TestStorageMonitor* monitor = new TestStorageMonitor();
35 scoped_ptr<StorageMonitor> pass_monitor(monitor); 35 std::unique_ptr<StorageMonitor> pass_monitor(monitor);
36 monitor->Init(); 36 monitor->Init();
37 monitor->MarkInitialized(); 37 monitor->MarkInitialized();
38 38
39 if (StorageMonitor::GetInstance() == NULL) { 39 if (StorageMonitor::GetInstance() == NULL) {
40 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); 40 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor));
41 return monitor; 41 return monitor;
42 } 42 }
43 43
44 return NULL; 44 return NULL;
45 } 45 }
46 46
47 // static 47 // static
48 TestStorageMonitor* TestStorageMonitor::CreateForBrowserTests() { 48 TestStorageMonitor* TestStorageMonitor::CreateForBrowserTests() {
49 TestStorageMonitor* monitor = new TestStorageMonitor(); 49 TestStorageMonitor* monitor = new TestStorageMonitor();
50 monitor->Init(); 50 monitor->Init();
51 monitor->MarkInitialized(); 51 monitor->MarkInitialized();
52 52
53 scoped_ptr<StorageMonitor> pass_monitor(monitor); 53 std::unique_ptr<StorageMonitor> pass_monitor(monitor);
54 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); 54 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor));
55 55
56 return monitor; 56 return monitor;
57 } 57 }
58 58
59 // static 59 // static
60 void TestStorageMonitor::SyncInitialize() { 60 void TestStorageMonitor::SyncInitialize() {
61 StorageMonitor* monitor = StorageMonitor::GetInstance(); 61 StorageMonitor* monitor = StorageMonitor::GetInstance();
62 if (monitor->IsInitialized()) 62 if (monitor->IsInitialized())
63 return; 63 return;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ejected_device_ = device_id; 131 ejected_device_ = device_id;
132 callback.Run(EJECT_OK); 132 callback.Run(EJECT_OK);
133 } 133 }
134 134
135 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { 135 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) {
136 CHECK(path.IsAbsolute()); 136 CHECK(path.IsAbsolute());
137 removable_paths_.push_back(path); 137 removable_paths_.push_back(path);
138 } 138 }
139 139
140 } // namespace storage_monitor 140 } // namespace storage_monitor
OLDNEW
« no previous file with comments | « components/storage_monitor/test_storage_monitor.h ('k') | components/storage_monitor/test_volume_mount_watcher_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698