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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chromeos/dbus/cros_disks_client.h" | 11 #include "chromeos/dbus/cros_disks_client.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 // A fake implementation of CrosDiskeClient. This class provides a fake behavior | 15 // A fake implementation of CrosDiskeClient. This class provides a fake behavior |
16 // and the user of this class can raise a fake mouse events. | 16 // and the user of this class can raise a fake mouse events. |
17 class FakeCrosDisksClient : public CrosDisksClient { | 17 class FakeCrosDisksClient : public CrosDisksClient { |
18 public: | 18 public: |
19 FakeCrosDisksClient(); | 19 FakeCrosDisksClient(); |
20 virtual ~FakeCrosDisksClient(); | 20 virtual ~FakeCrosDisksClient(); |
21 | 21 |
22 // CrosDisksClient overrides | 22 // CrosDisksClient overrides |
23 virtual void Init(dbus::Bus* bus) OVERRIDE; | 23 virtual void Init(dbus::Bus* bus) override; |
24 virtual void Mount(const std::string& source_path, | 24 virtual void Mount(const std::string& source_path, |
25 const std::string& source_format, | 25 const std::string& source_format, |
26 const std::string& mount_label, | 26 const std::string& mount_label, |
27 const base::Closure& callback, | 27 const base::Closure& callback, |
28 const base::Closure& error_callback) OVERRIDE; | 28 const base::Closure& error_callback) override; |
29 virtual void Unmount(const std::string& device_path, | 29 virtual void Unmount(const std::string& device_path, |
30 UnmountOptions options, | 30 UnmountOptions options, |
31 const base::Closure& callback, | 31 const base::Closure& callback, |
32 const base::Closure& error_callback) OVERRIDE; | 32 const base::Closure& error_callback) override; |
33 virtual void EnumerateAutoMountableDevices( | 33 virtual void EnumerateAutoMountableDevices( |
34 const EnumerateAutoMountableDevicesCallback& callback, | 34 const EnumerateAutoMountableDevicesCallback& callback, |
35 const base::Closure& error_callback) OVERRIDE; | 35 const base::Closure& error_callback) override; |
36 virtual void EnumerateMountEntries( | 36 virtual void EnumerateMountEntries( |
37 const EnumerateMountEntriesCallback& callback, | 37 const EnumerateMountEntriesCallback& callback, |
38 const base::Closure& error_callback) OVERRIDE; | 38 const base::Closure& error_callback) override; |
39 virtual void Format(const std::string& device_path, | 39 virtual void Format(const std::string& device_path, |
40 const std::string& filesystem, | 40 const std::string& filesystem, |
41 const base::Closure& callback, | 41 const base::Closure& callback, |
42 const base::Closure& error_callback) OVERRIDE; | 42 const base::Closure& error_callback) override; |
43 virtual void GetDeviceProperties( | 43 virtual void GetDeviceProperties( |
44 const std::string& device_path, | 44 const std::string& device_path, |
45 const GetDevicePropertiesCallback& callback, | 45 const GetDevicePropertiesCallback& callback, |
46 const base::Closure& error_callback) OVERRIDE; | 46 const base::Closure& error_callback) override; |
47 virtual void SetMountEventHandler( | 47 virtual void SetMountEventHandler( |
48 const MountEventHandler& mount_event_handler) OVERRIDE; | 48 const MountEventHandler& mount_event_handler) override; |
49 virtual void SetMountCompletedHandler( | 49 virtual void SetMountCompletedHandler( |
50 const MountCompletedHandler& mount_completed_handler) OVERRIDE; | 50 const MountCompletedHandler& mount_completed_handler) override; |
51 virtual void SetFormatCompletedHandler( | 51 virtual void SetFormatCompletedHandler( |
52 const FormatCompletedHandler& format_completed_handler) OVERRIDE; | 52 const FormatCompletedHandler& format_completed_handler) override; |
53 | 53 |
54 // Used in tests to simulate signals sent by cros disks layer. | 54 // Used in tests to simulate signals sent by cros disks layer. |
55 // Invokes handlers set in |SetMountEventHandler|, |SetMountCompletedHandler|, | 55 // Invokes handlers set in |SetMountEventHandler|, |SetMountCompletedHandler|, |
56 // and |SetFormatCompletedHandler|. | 56 // and |SetFormatCompletedHandler|. |
57 bool SendMountEvent(MountEventType event, const std::string& path); | 57 bool SendMountEvent(MountEventType event, const std::string& path); |
58 bool SendMountCompletedEvent(MountError error_code, | 58 bool SendMountCompletedEvent(MountError error_code, |
59 const std::string& source_path, | 59 const std::string& source_path, |
60 MountType mount_type, | 60 MountType mount_type, |
61 const std::string& mount_path); | 61 const std::string& mount_path); |
62 bool SendFormatCompletedEvent(FormatError error_code, | 62 bool SendFormatCompletedEvent(FormatError error_code, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 base::Closure unmount_listener_; | 120 base::Closure unmount_listener_; |
121 int format_call_count_; | 121 int format_call_count_; |
122 std::string last_format_device_path_; | 122 std::string last_format_device_path_; |
123 std::string last_format_filesystem_; | 123 std::string last_format_filesystem_; |
124 bool format_success_; | 124 bool format_success_; |
125 }; | 125 }; |
126 | 126 |
127 } // namespace chromeos | 127 } // namespace chromeos |
128 | 128 |
129 #endif // CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ | 129 #endif // CHROMEOS_DBUS_FAKE_CROS_DISKS_CLIENT_H_ |
OLD | NEW |