| 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> | 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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "components/storage_monitor/storage_info.h" | 12 #include "components/storage_monitor/storage_info.h" |
| 13 | 13 |
| 14 #if defined(OS_LINUX) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "components/storage_monitor/test_media_transfer_protocol_manager_linux.
h" | 15 #include "components/storage_monitor/test_media_transfer_protocol_manager_chrome
os.h" |
| 16 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" //
nogncheck | 16 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" //
nogncheck |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace storage_monitor { | 19 namespace storage_monitor { |
| 20 | 20 |
| 21 TestStorageMonitor::TestStorageMonitor() | 21 TestStorageMonitor::TestStorageMonitor() |
| 22 : StorageMonitor(), | 22 : StorageMonitor(), |
| 23 init_called_(false) { | 23 init_called_(false) { |
| 24 #if defined(OS_LINUX) | 24 #if defined(OS_CHROMEOS) |
| 25 media_transfer_protocol_manager_.reset( | 25 media_transfer_protocol_manager_.reset( |
| 26 new TestMediaTransferProtocolManagerLinux()); | 26 new TestMediaTransferProtocolManagerChromeOS()); |
| 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 std::unique_ptr<StorageMonitor> pass_monitor(monitor); | 35 std::unique_ptr<StorageMonitor> pass_monitor(monitor); |
| 36 monitor->Init(); | 36 monitor->Init(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| 110 bool TestStorageMonitor::GetMTPStorageInfoFromDeviceId( | 110 bool TestStorageMonitor::GetMTPStorageInfoFromDeviceId( |
| 111 const std::string& storage_device_id, | 111 const std::string& storage_device_id, |
| 112 base::string16* device_location, | 112 base::string16* device_location, |
| 113 base::string16* storage_object_id) const { | 113 base::string16* storage_object_id) const { |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 #if defined(OS_LINUX) | 118 #if defined(OS_CHROMEOS) |
| 119 device::MediaTransferProtocolManager* | 119 device::MediaTransferProtocolManager* |
| 120 TestStorageMonitor::media_transfer_protocol_manager() { | 120 TestStorageMonitor::media_transfer_protocol_manager() { |
| 121 return media_transfer_protocol_manager_.get(); | 121 return media_transfer_protocol_manager_.get(); |
| 122 } | 122 } |
| 123 #endif | 123 #endif |
| 124 | 124 |
| 125 StorageMonitor::Receiver* TestStorageMonitor::receiver() const { | 125 StorageMonitor::Receiver* TestStorageMonitor::receiver() const { |
| 126 return StorageMonitor::receiver(); | 126 return StorageMonitor::receiver(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void TestStorageMonitor::EjectDevice( | 129 void TestStorageMonitor::EjectDevice( |
| 130 const std::string& device_id, | 130 const std::string& device_id, |
| 131 base::Callback<void(EjectStatus)> callback) { | 131 base::Callback<void(EjectStatus)> callback) { |
| 132 ejected_device_ = device_id; | 132 ejected_device_ = device_id; |
| 133 callback.Run(EJECT_OK); | 133 callback.Run(EJECT_OK); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { | 136 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { |
| 137 CHECK(path.IsAbsolute()); | 137 CHECK(path.IsAbsolute()); |
| 138 removable_paths_.push_back(path); | 138 removable_paths_.push_back(path); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace storage_monitor | 141 } // namespace storage_monitor |
| OLD | NEW |