| 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 CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_path.h" |
| 11 #include "chromeos/dbus/cros_disks_client.h" | 13 #include "chromeos/dbus/cros_disks_client.h" |
| 12 | 14 |
| 13 namespace chromeos { | 15 namespace chromeos { |
| 14 | 16 |
| 15 // A fake implementation of CrosDiskeClient. This class provides a fake behavior | 17 // A fake implementation of CrosDiskeClient. This class provides a fake behavior |
| 16 // and the user of this class can raise a fake mouse events. | 18 // and the user of this class can raise a fake mouse events. |
| 17 class FakeCrosDisksClient : public CrosDisksClient { | 19 class CHROMEOS_EXPORT FakeCrosDisksClient : public CrosDisksClient { |
| 18 public: | 20 public: |
| 19 FakeCrosDisksClient(); | 21 FakeCrosDisksClient(); |
| 20 virtual ~FakeCrosDisksClient(); | 22 virtual ~FakeCrosDisksClient(); |
| 21 | 23 |
| 22 // CrosDisksClient overrides | 24 // CrosDisksClient overrides |
| 23 virtual void Init(dbus::Bus* bus) override; | 25 virtual void Init(dbus::Bus* bus) override; |
| 26 |
| 27 // Performs fake mounting for archive files. Instead of actually extracting |
| 28 // contents of archive files, this function creates a directory that |
| 29 // contains a dummy file. |
| 24 virtual void Mount(const std::string& source_path, | 30 virtual void Mount(const std::string& source_path, |
| 25 const std::string& source_format, | 31 const std::string& source_format, |
| 26 const std::string& mount_label, | 32 const std::string& mount_label, |
| 27 const base::Closure& callback, | 33 const base::Closure& callback, |
| 28 const base::Closure& error_callback) override; | 34 const base::Closure& error_callback) override; |
| 35 // Deletes the directory created in Mount(). |
| 29 virtual void Unmount(const std::string& device_path, | 36 virtual void Unmount(const std::string& device_path, |
| 30 UnmountOptions options, | 37 UnmountOptions options, |
| 31 const base::Closure& callback, | 38 const base::Closure& callback, |
| 32 const base::Closure& error_callback) override; | 39 const base::Closure& error_callback) override; |
| 33 virtual void EnumerateAutoMountableDevices( | 40 virtual void EnumerateAutoMountableDevices( |
| 34 const EnumerateAutoMountableDevicesCallback& callback, | 41 const EnumerateAutoMountableDevicesCallback& callback, |
| 35 const base::Closure& error_callback) override; | 42 const base::Closure& error_callback) override; |
| 36 virtual void EnumerateMountEntries( | 43 virtual void EnumerateMountEntries( |
| 37 const EnumerateMountEntriesCallback& callback, | 44 const EnumerateMountEntriesCallback& callback, |
| 38 const base::Closure& error_callback) override; | 45 const base::Closure& error_callback) override; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 122 |
| 116 int unmount_call_count_; | 123 int unmount_call_count_; |
| 117 std::string last_unmount_device_path_; | 124 std::string last_unmount_device_path_; |
| 118 UnmountOptions last_unmount_options_; | 125 UnmountOptions last_unmount_options_; |
| 119 bool unmount_success_; | 126 bool unmount_success_; |
| 120 base::Closure unmount_listener_; | 127 base::Closure unmount_listener_; |
| 121 int format_call_count_; | 128 int format_call_count_; |
| 122 std::string last_format_device_path_; | 129 std::string last_format_device_path_; |
| 123 std::string last_format_filesystem_; | 130 std::string last_format_filesystem_; |
| 124 bool format_success_; | 131 bool format_success_; |
| 132 std::set<base::FilePath> mounted_paths_; |
| 125 }; | 133 }; |
| 126 | 134 |
| 127 } // namespace chromeos | 135 } // namespace chromeos |
| 128 | 136 |
| 129 #endif // CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ | 137 #endif // CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ |
| OLD | NEW |