| OLD | NEW |
| 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> |
| 8 |
| 7 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 8 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 10 #include "components/storage_monitor/storage_info.h" | 12 #include "components/storage_monitor/storage_info.h" |
| 11 | 13 |
| 12 #if defined(OS_LINUX) | 14 #if defined(OS_LINUX) |
| 13 #include "components/storage_monitor/test_media_transfer_protocol_manager_linux.
h" | 15 #include "components/storage_monitor/test_media_transfer_protocol_manager_linux.
h" |
| 14 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" //
nogncheck | 16 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" //
nogncheck |
| 15 #endif | 17 #endif |
| 16 | 18 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 28 TestStorageMonitor::~TestStorageMonitor() {} | 30 TestStorageMonitor::~TestStorageMonitor() {} |
| 29 | 31 |
| 30 // static | 32 // static |
| 31 TestStorageMonitor* TestStorageMonitor::CreateAndInstall() { | 33 TestStorageMonitor* TestStorageMonitor::CreateAndInstall() { |
| 32 TestStorageMonitor* monitor = new TestStorageMonitor(); | 34 TestStorageMonitor* monitor = new TestStorageMonitor(); |
| 33 scoped_ptr<StorageMonitor> pass_monitor(monitor); | 35 scoped_ptr<StorageMonitor> pass_monitor(monitor); |
| 34 monitor->Init(); | 36 monitor->Init(); |
| 35 monitor->MarkInitialized(); | 37 monitor->MarkInitialized(); |
| 36 | 38 |
| 37 if (StorageMonitor::GetInstance() == NULL) { | 39 if (StorageMonitor::GetInstance() == NULL) { |
| 38 StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass()); | 40 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); |
| 39 return monitor; | 41 return monitor; |
| 40 } | 42 } |
| 41 | 43 |
| 42 return NULL; | 44 return NULL; |
| 43 } | 45 } |
| 44 | 46 |
| 45 // static | 47 // static |
| 46 TestStorageMonitor* TestStorageMonitor::CreateForBrowserTests() { | 48 TestStorageMonitor* TestStorageMonitor::CreateForBrowserTests() { |
| 47 TestStorageMonitor* monitor = new TestStorageMonitor(); | 49 TestStorageMonitor* monitor = new TestStorageMonitor(); |
| 48 monitor->Init(); | 50 monitor->Init(); |
| 49 monitor->MarkInitialized(); | 51 monitor->MarkInitialized(); |
| 50 | 52 |
| 51 scoped_ptr<StorageMonitor> pass_monitor(monitor); | 53 scoped_ptr<StorageMonitor> pass_monitor(monitor); |
| 52 StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass()); | 54 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); |
| 53 | 55 |
| 54 return monitor; | 56 return monitor; |
| 55 } | 57 } |
| 56 | 58 |
| 57 // static | 59 // static |
| 58 void TestStorageMonitor::SyncInitialize() { | 60 void TestStorageMonitor::SyncInitialize() { |
| 59 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 61 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
| 60 if (monitor->IsInitialized()) | 62 if (monitor->IsInitialized()) |
| 61 return; | 63 return; |
| 62 | 64 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 ejected_device_ = device_id; | 131 ejected_device_ = device_id; |
| 130 callback.Run(EJECT_OK); | 132 callback.Run(EJECT_OK); |
| 131 } | 133 } |
| 132 | 134 |
| 133 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { | 135 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { |
| 134 CHECK(path.IsAbsolute()); | 136 CHECK(path.IsAbsolute()); |
| 135 removable_paths_.push_back(path); | 137 removable_paths_.push_back(path); |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace storage_monitor | 140 } // namespace storage_monitor |
| OLD | NEW |