Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / fake_disk_mount_manager.h
blob5e44060996c5c36ca780be153ce2356b04286522
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/observer_list.h"
14 #include "chromeos/dbus/cros_disks_client.h"
15 #include "chromeos/disks/disk_mount_manager.h"
17 namespace file_manager {
19 class FakeDiskMountManager : public chromeos::disks::DiskMountManager {
20 public:
21 struct MountRequest {
22 MountRequest(const std::string& source_path,
23 const std::string& source_format,
24 const std::string& mount_label,
25 chromeos::MountType type);
27 std::string source_path;
28 std::string source_format;
29 std::string mount_label;
30 chromeos::MountType type;
33 struct UnmountRequest {
34 UnmountRequest(const std::string& mount_path,
35 chromeos::UnmountOptions options);
37 std::string mount_path;
38 chromeos::UnmountOptions options;
41 FakeDiskMountManager();
42 ~FakeDiskMountManager() override;
44 const std::vector<MountRequest>& mount_requests() const {
45 return mount_requests_;
47 const std::vector<UnmountRequest>& unmount_requests() const {
48 return unmount_requests_;
51 // DiskMountManager overrides.
52 void AddObserver(Observer* observer) override;
53 void RemoveObserver(Observer* observer) override;
54 const DiskMap& disks() const override;
55 const Disk* FindDiskBySourcePath(
56 const std::string& source_path) const override;
57 const MountPointMap& mount_points() const override;
58 void EnsureMountInfoRefreshed(
59 const EnsureMountInfoRefreshedCallback& callback,
60 bool force) override;
61 void MountPath(const std::string& source_path,
62 const std::string& source_format,
63 const std::string& mount_label,
64 chromeos::MountType type) override;
65 void UnmountPath(const std::string& mount_path,
66 chromeos::UnmountOptions options,
67 const UnmountPathCallback& callback) override;
68 void FormatMountedDevice(const std::string& mount_path) override;
69 void UnmountDeviceRecursively(
70 const std::string& device_path,
71 const UnmountDeviceRecursivelyCallbackType& callback) override;
73 bool AddDiskForTest(Disk* disk) override;
74 bool AddMountPointForTest(const MountPointInfo& mount_point) override;
75 void InvokeDiskEventForTest(DiskEvent event, const Disk* disk);
77 private:
78 base::ObserverList<Observer> observers_;
80 DiskMap disks_;
81 MountPointMap mount_points_;
83 std::vector<MountRequest> mount_requests_;
84 std::vector<UnmountRequest> unmount_requests_;
86 DISALLOW_COPY_AND_ASSIGN(FakeDiskMountManager);
89 } // namespace file_manager
91 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_