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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_
10 #include "chrome/browser/storage_monitor/storage_monitor.h"
12 class TestStorageMonitor
: public StorageMonitor
{
15 virtual ~TestStorageMonitor();
17 virtual void Init() OVERRIDE
;
19 void MarkInitialized();
21 // Create and initialize a new TestStorageMonitor and install it
22 // in the TestingBrowserProcess. The TestingBrowserProcess owns the created
23 // TestStorageMonitor, but it is also returned for convenience. If there is
24 // no TestingBrowserProcess to own the TestStorageMonitor, it is destroyed
25 // and the return value is NULL.
26 static TestStorageMonitor
* CreateAndInstall();
28 // Create and initialize a new TestStorageMonitor, and install it
29 // in the BrowserProcessImpl. (Browser tests use the production browser
30 // process implementation.) The BrowserProcessImpl owns the created
31 // TestStorageMonitor, but it is also returned for convenience.
32 static TestStorageMonitor
* CreateForBrowserTests();
34 // Remove the singleton StorageMonitor from the TestingBrowserProcess.
35 static void RemoveSingleton();
37 // Synchronously initialize the current storage monitor.
38 static void SyncInitialize();
40 virtual bool GetStorageInfoForPath(
41 const base::FilePath
& path
,
42 StorageInfo
* device_info
) const OVERRIDE
;
45 virtual bool GetMTPStorageInfoFromDeviceId(
46 const std::string
& storage_device_id
,
47 base::string16
* device_location
,
48 base::string16
* storage_object_id
) const OVERRIDE
;
52 virtual device::MediaTransferProtocolManager
*
53 media_transfer_protocol_manager() OVERRIDE
;
56 virtual Receiver
* receiver() const OVERRIDE
;
58 virtual void EjectDevice(
59 const std::string
& device_id
,
60 base::Callback
<void(StorageMonitor::EjectStatus
)> callback
)
63 const std::string
& ejected_device() const { return ejected_device_
; }
65 bool init_called() const { return init_called_
; }
68 // Whether TestStorageMonitor::Init() has been called for not.
71 // The last device to be ejected.
72 std::string ejected_device_
;
75 scoped_ptr
<device::MediaTransferProtocolManager
>
76 media_transfer_protocol_manager_
;
80 #endif // CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_