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/storage_info.h" | 7 #include "chrome/browser/storage_monitor/storage_info.h" |
8 #include "chrome/test/base/testing_browser_process.h" | |
8 | 9 |
9 #if defined(OS_LINUX) | 10 #if defined(OS_LINUX) |
10 #include "chrome/browser/storage_monitor/test_media_transfer_protocol_manager_li nux.h" | 11 #include "chrome/browser/storage_monitor/test_media_transfer_protocol_manager_li nux.h" |
11 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 12 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
12 #endif | 13 #endif |
13 | 14 |
14 namespace chrome { | 15 namespace chrome { |
15 namespace test { | 16 namespace test { |
16 | 17 |
17 TestStorageMonitor::TestStorageMonitor() | 18 TestStorageMonitor::TestStorageMonitor() |
18 : StorageMonitor(), | 19 : StorageMonitor(), |
19 init_called_(false) { | 20 init_called_(false) { |
20 #if defined(OS_LINUX) | 21 #if defined(OS_LINUX) |
21 media_transfer_protocol_manager_.reset( | 22 media_transfer_protocol_manager_.reset( |
22 new TestMediaTransferProtocolManagerLinux()); | 23 new TestMediaTransferProtocolManagerLinux()); |
23 #endif | 24 #endif |
24 } | 25 } |
25 | 26 |
26 TestStorageMonitor::~TestStorageMonitor() {} | 27 TestStorageMonitor::~TestStorageMonitor() {} |
27 | 28 |
29 void TestStorageMonitor::RemoveSingleton() { | |
Lei Zhang
2013/06/27 00:09:38
Why do we have this and RemoveSingletonForTesting?
Greg Billock
2013/06/27 18:25:43
Getting rid of the StorageMonitor singleton will l
| |
30 StorageMonitor::RemoveSingletonForTesting(); | |
31 TestingBrowserProcess* browser_process = TestingBrowserProcess::GetGlobal(); | |
32 if (browser_process) | |
33 browser_process->SetStorageMonitor(NULL); | |
34 } | |
35 | |
28 TestStorageMonitor* | 36 TestStorageMonitor* |
29 TestStorageMonitor::CreateForBrowserTests() { | 37 TestStorageMonitor::CreateForBrowserTests() { |
30 StorageMonitor::RemoveSingletonForTesting(); | 38 StorageMonitor::RemoveSingletonForTesting(); |
31 return new TestStorageMonitor(); | 39 return new TestStorageMonitor(); |
32 } | 40 } |
33 | 41 |
34 void TestStorageMonitor::Init() { | 42 void TestStorageMonitor::Init() { |
35 init_called_ = true; | 43 init_called_ = true; |
36 } | 44 } |
37 | 45 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 85 |
78 void TestStorageMonitor::EjectDevice( | 86 void TestStorageMonitor::EjectDevice( |
79 const std::string& device_id, | 87 const std::string& device_id, |
80 base::Callback<void(EjectStatus)> callback) { | 88 base::Callback<void(EjectStatus)> callback) { |
81 ejected_device_ = device_id; | 89 ejected_device_ = device_id; |
82 callback.Run(EJECT_OK); | 90 callback.Run(EJECT_OK); |
83 } | 91 } |
84 | 92 |
85 } // namespace test | 93 } // namespace test |
86 } // namespace chrome | 94 } // namespace chrome |
OLD | NEW |