OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <queue> | |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "chromeos/dbus/cros_disks_client.h" | 15 #include "chromeos/dbus/cros_disks_client.h" |
15 #include "chromeos/disks/disk_mount_manager.h" | 16 #include "chromeos/disks/disk_mount_manager.h" |
16 | 17 |
17 namespace file_manager { | 18 namespace file_manager { |
18 | 19 |
19 class FakeDiskMountManager : public chromeos::disks::DiskMountManager { | 20 class FakeDiskMountManager : public chromeos::disks::DiskMountManager { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 const std::string& source_path) const override; | 60 const std::string& source_path) const override; |
60 const MountPointMap& mount_points() const override; | 61 const MountPointMap& mount_points() const override; |
61 void EnsureMountInfoRefreshed( | 62 void EnsureMountInfoRefreshed( |
62 const EnsureMountInfoRefreshedCallback& callback, | 63 const EnsureMountInfoRefreshedCallback& callback, |
63 bool force) override; | 64 bool force) override; |
64 void MountPath(const std::string& source_path, | 65 void MountPath(const std::string& source_path, |
65 const std::string& source_format, | 66 const std::string& source_format, |
66 const std::string& mount_label, | 67 const std::string& mount_label, |
67 chromeos::MountType type, | 68 chromeos::MountType type, |
68 chromeos::MountAccessMode access_mode) override; | 69 chromeos::MountAccessMode access_mode) override; |
70 // In order to simulate asynchronous invocation of callbacks after unmount | |
71 // is finished, |callback| will be invoked only when | |
72 // |FinishAllUnmountRequest()| is called. | |
69 void UnmountPath(const std::string& mount_path, | 73 void UnmountPath(const std::string& mount_path, |
70 chromeos::UnmountOptions options, | 74 chromeos::UnmountOptions options, |
71 const UnmountPathCallback& callback) override; | 75 const UnmountPathCallback& callback) override; |
76 // Emulates that all mount request finished. | |
77 // Return true if there was one or more mount request enqueued, or false | |
78 // otherwise. | |
79 bool FinishAllUnmountPathRequests(); | |
fukino
2016/09/16 07:31:34
This is not an override of DiskMountManager.
We n
yamaguchi
2016/09/26 02:25:28
Done.
| |
72 void FormatMountedDevice(const std::string& mount_path) override; | 80 void FormatMountedDevice(const std::string& mount_path) override; |
73 void UnmountDeviceRecursively( | 81 void UnmountDeviceRecursively( |
74 const std::string& device_path, | 82 const std::string& device_path, |
75 const UnmountDeviceRecursivelyCallbackType& callback) override; | 83 const UnmountDeviceRecursivelyCallbackType& callback) override; |
76 | 84 |
77 bool AddDiskForTest(Disk* disk) override; | 85 bool AddDiskForTest(Disk* disk) override; |
78 bool AddMountPointForTest(const MountPointInfo& mount_point) override; | 86 bool AddMountPointForTest(const MountPointInfo& mount_point) override; |
79 void InvokeDiskEventForTest(DiskEvent event, const Disk* disk); | 87 void InvokeDiskEventForTest(DiskEvent event, const Disk* disk); |
80 | 88 |
81 private: | 89 private: |
82 base::ObserverList<Observer> observers_; | 90 base::ObserverList<Observer> observers_; |
91 std::queue<UnmountPathCallback> pending_unmount_callbacks_; | |
83 | 92 |
84 DiskMap disks_; | 93 DiskMap disks_; |
85 MountPointMap mount_points_; | 94 MountPointMap mount_points_; |
86 | 95 |
87 std::vector<MountRequest> mount_requests_; | 96 std::vector<MountRequest> mount_requests_; |
88 std::vector<UnmountRequest> unmount_requests_; | 97 std::vector<UnmountRequest> unmount_requests_; |
89 | 98 |
90 DISALLOW_COPY_AND_ASSIGN(FakeDiskMountManager); | 99 DISALLOW_COPY_AND_ASSIGN(FakeDiskMountManager); |
91 }; | 100 }; |
92 | 101 |
93 } // namespace file_manager | 102 } // namespace file_manager |
94 | 103 |
95 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_ |
OLD | NEW |