Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1664)

Unified Diff: chrome/browser/chromeos/file_manager/mounted_disk_monitor.h

Issue 23676008: Refactor MountedDiskMonitior and adds its test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
diff --git a/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h b/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
index f26e4a8fb9c7ca13b795fec7e6de6c3f5046037b..bb0c540fd551df4942e4d2aa243035f7e91b02a8 100644
--- a/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
+++ b/chrome/browser/chromeos/file_manager/mounted_disk_monitor.h
@@ -25,7 +25,9 @@ class MountedDiskMonitor
: public chromeos::PowerManagerClient::Observer,
public chromeos::disks::DiskMountManager::Observer {
public:
- MountedDiskMonitor();
+ MountedDiskMonitor(
+ chromeos::PowerManagerClient* power_manager_client,
+ chromeos::disks::DiskMountManager* disk_mount_manager);
virtual ~MountedDiskMonitor();
// PowerManagerClient::Observer overrides:
@@ -53,6 +55,14 @@ class MountedDiskMonitor
// been unmounted during the resuming time span.
bool DiskIsRemounting(
const chromeos::disks::DiskMountManager::Disk& disk) const;
+
+ // In order to avoid consuming time a lot for testing, this allows to set the
+ // resuming time span.
+ void set_resuming_time_span_for_testing(
+ const base::TimeDelta& resuming_time_span) {
+ resuming_time_span_ = resuming_time_span;
+ }
+
private:
// Maps source paths with corresponding uuids.
typedef std::map<std::string, std::string> DiskMap;
@@ -62,9 +72,13 @@ class MountedDiskMonitor
void Reset();
+ chromeos::PowerManagerClient* power_manager_client_;
+ chromeos::disks::DiskMountManager* disk_mount_manager_;
+
bool is_resuming_;
DiskMap mounted_disks_;
DiskSet unmounted_while_resuming_;
+ base::TimeDelta resuming_time_span_;
base::WeakPtrFactory<MountedDiskMonitor> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MountedDiskMonitor);

Powered by Google App Engine
This is Rietveld 408576698