| 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 #ifndef CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ | 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ |
| 6 #define CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ | 6 #define CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/storage_monitor/storage_monitor.h" | 10 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 11 | 11 |
| 12 namespace chrome { | 12 namespace chrome { |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 class TestStorageMonitor : public chrome::StorageMonitor { | 15 class TestStorageMonitor : public chrome::StorageMonitor { |
| 16 public: | 16 public: |
| 17 TestStorageMonitor(); | 17 TestStorageMonitor(); |
| 18 virtual ~TestStorageMonitor(); | 18 virtual ~TestStorageMonitor(); |
| 19 | 19 |
| 20 virtual void Init() OVERRIDE; | 20 virtual void Init() OVERRIDE; |
| 21 | 21 |
| 22 void MarkInitialized(); | 22 void MarkInitialized(); |
| 23 | 23 |
| 24 // Create and initialize a new TestStorageMonitor and install it | 24 // Create and initialize a new TestStorageMonitor and install it |
| 25 // in the TestingBrowserProcess. | 25 // in the TestingBrowserProcess. The TestingBrowserProcess owns the created |
| 26 // TestStorageMonitor, but it is also returned for convenience. If there is |
| 27 // no TestingBrowserProcess to own the TestStorageMonitor, it is destroyed |
| 28 // and the return value is NULL. |
| 26 static TestStorageMonitor* CreateAndInstall(); | 29 static TestStorageMonitor* CreateAndInstall(); |
| 27 | 30 |
| 28 // Create and initialize a new TestStorageMonitor, and install it | 31 // Create and initialize a new TestStorageMonitor, and install it |
| 29 // in the BrowserProcessImpl. (Browser tests use the production browser | 32 // in the BrowserProcessImpl. (Browser tests use the production browser |
| 30 // process implementation.) | 33 // process implementation.) The BrowserProcessImpl owns the created |
| 34 // TestStorageMonitor, but it is also returned for convenience. |
| 31 static TestStorageMonitor* CreateForBrowserTests(); | 35 static TestStorageMonitor* CreateForBrowserTests(); |
| 32 | 36 |
| 33 // Remove the singleton StorageMonitor from the TestingBrowserProcess. | 37 // Remove the singleton StorageMonitor from the TestingBrowserProcess. |
| 34 static void RemoveSingleton(); | 38 static void RemoveSingleton(); |
| 35 | 39 |
| 36 // Synchronously initialize the current storage monitor. | 40 // Synchronously initialize the current storage monitor. |
| 37 static void SyncInitialize(); | 41 static void SyncInitialize(); |
| 38 | 42 |
| 39 virtual bool GetStorageInfoForPath( | 43 virtual bool GetStorageInfoForPath( |
| 40 const base::FilePath& path, | 44 const base::FilePath& path, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 54 | 58 |
| 55 virtual Receiver* receiver() const OVERRIDE; | 59 virtual Receiver* receiver() const OVERRIDE; |
| 56 | 60 |
| 57 virtual void EjectDevice( | 61 virtual void EjectDevice( |
| 58 const std::string& device_id, | 62 const std::string& device_id, |
| 59 base::Callback<void(StorageMonitor::EjectStatus)> callback) | 63 base::Callback<void(StorageMonitor::EjectStatus)> callback) |
| 60 OVERRIDE; | 64 OVERRIDE; |
| 61 | 65 |
| 62 const std::string& ejected_device() const { return ejected_device_; } | 66 const std::string& ejected_device() const { return ejected_device_; } |
| 63 | 67 |
| 68 bool init_called() const { return init_called_; } |
| 69 |
| 70 private: |
| 71 // Whether TestStorageMonitor::Init() has been called for not. |
| 64 bool init_called_; | 72 bool init_called_; |
| 65 | 73 |
| 66 private: | 74 // The last device to be ejected. |
| 67 std::string ejected_device_; | 75 std::string ejected_device_; |
| 68 | 76 |
| 69 #if defined(OS_LINUX) | 77 #if defined(OS_LINUX) |
| 70 scoped_ptr<device::MediaTransferProtocolManager> | 78 scoped_ptr<device::MediaTransferProtocolManager> |
| 71 media_transfer_protocol_manager_; | 79 media_transfer_protocol_manager_; |
| 72 #endif | 80 #endif |
| 73 }; | 81 }; |
| 74 | 82 |
| 75 } // namespace test | 83 } // namespace test |
| 76 } // namespace chrome | 84 } // namespace chrome |
| 77 | 85 |
| 78 #endif // CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ | 86 #endif // CHROME_BROWSER_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_ |
| OLD | NEW |