| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/storage_monitor/test_storage_monitor.h" | 5 #include "chrome/browser/storage_monitor/test_storage_monitor.h" |
| 6 | 6 |
| 7 #include "chrome/browser/storage_monitor/media_storage_util.h" | 7 #include "chrome/browser/storage_monitor/media_storage_util.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 8 | 10 |
| 9 namespace chrome { | 11 namespace chrome { |
| 10 namespace test { | 12 namespace test { |
| 11 | 13 |
| 12 TestStorageMonitor::TestStorageMonitor() | 14 TestStorageMonitor::TestStorageMonitor() |
| 13 : StorageMonitor() {} | 15 : StorageMonitor() { |
| 16 #if defined(OS_LINUX) |
| 17 scoped_refptr<base::MessageLoopProxy> loop_proxy = |
| 18 content::BrowserThread::GetMessageLoopProxyForThread( |
| 19 content::BrowserThread::FILE); |
| 20 media_transfer_protocol_manager_.reset( |
| 21 device::MediaTransferProtocolManager::Initialize(loop_proxy, true)); |
| 22 #endif |
| 23 } |
| 14 | 24 |
| 15 TestStorageMonitor::~TestStorageMonitor() {} | 25 TestStorageMonitor::~TestStorageMonitor() {} |
| 16 | 26 |
| 17 TestStorageMonitor* | 27 TestStorageMonitor* |
| 18 TestStorageMonitor::CreateForBrowserTests() { | 28 TestStorageMonitor::CreateForBrowserTests() { |
| 19 StorageMonitor::RemoveSingletonForTesting(); | 29 StorageMonitor::RemoveSingletonForTesting(); |
| 20 return new TestStorageMonitor(); | 30 return new TestStorageMonitor(); |
| 21 } | 31 } |
| 22 | 32 |
| 23 bool TestStorageMonitor::GetStorageInfoForPath( | 33 bool TestStorageMonitor::GetStorageInfoForPath( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 | 48 |
| 39 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
| 40 bool TestStorageMonitor::GetMTPStorageInfoFromDeviceId( | 50 bool TestStorageMonitor::GetMTPStorageInfoFromDeviceId( |
| 41 const std::string& storage_device_id, | 51 const std::string& storage_device_id, |
| 42 string16* device_location, | 52 string16* device_location, |
| 43 string16* storage_object_id) const { | 53 string16* storage_object_id) const { |
| 44 return false; | 54 return false; |
| 45 } | 55 } |
| 46 #endif | 56 #endif |
| 47 | 57 |
| 58 #if defined(OS_LINUX) |
| 59 device::MediaTransferProtocolManager* |
| 60 TestStorageMonitor::media_transfer_protocol_manager() { |
| 61 return media_transfer_protocol_manager_.get(); |
| 62 } |
| 63 #endif |
| 64 |
| 48 StorageMonitor::Receiver* TestStorageMonitor::receiver() const { | 65 StorageMonitor::Receiver* TestStorageMonitor::receiver() const { |
| 49 return StorageMonitor::receiver(); | 66 return StorageMonitor::receiver(); |
| 50 } | 67 } |
| 51 | 68 |
| 52 void TestStorageMonitor::EjectDevice( | 69 void TestStorageMonitor::EjectDevice( |
| 53 const std::string& device_id, | 70 const std::string& device_id, |
| 54 base::Callback<void(EjectStatus)> callback) { | 71 base::Callback<void(EjectStatus)> callback) { |
| 55 ejected_device_ = device_id; | 72 ejected_device_ = device_id; |
| 56 callback.Run(EJECT_OK); | 73 callback.Run(EJECT_OK); |
| 57 } | 74 } |
| 58 | 75 |
| 59 } // namespace test | 76 } // namespace test |
| 60 } // namespace chrome | 77 } // namespace chrome |
| OLD | NEW |