summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/fake_cros_disks_client.h
diff options
context:
space:
mode:
authorharuki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 04:58:56 +0000
committerharuki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-14 04:58:56 +0000
commitcc70f5017d56dee38acfaebd5f7a24c8af830e07 (patch)
tree778a74caab9e64a025d660e53a71e8b445980136 /chromeos/dbus/fake_cros_disks_client.h
parent301528546d702e1d3adf2cf3ba178b556d0bb9a2 (diff)
downloadchromium_src-cc70f5017d56dee38acfaebd5f7a24c8af830e07.zip
chromium_src-cc70f5017d56dee38acfaebd5f7a24c8af830e07.tar.gz
chromium_src-cc70f5017d56dee38acfaebd5f7a24c8af830e07.tar.bz2
Use MockDBusThreadManagerWithoutGMock for DiskMountManagerTest
Adding FakeCrosDisksClient some utilities to inspect methods calls. BUG=223061 TEST=trybots R=satorux@chromium.org Review URL: https://codereview.chromium.org/14565003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/fake_cros_disks_client.h')
-rw-r--r--chromeos/dbus/fake_cros_disks_client.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/chromeos/dbus/fake_cros_disks_client.h b/chromeos/dbus/fake_cros_disks_client.h
index 511c11d..75907aa 100644
--- a/chromeos/dbus/fake_cros_disks_client.h
+++ b/chromeos/dbus/fake_cros_disks_client.h
@@ -52,9 +52,68 @@ class FakeCrosDisksClient : public CrosDisksClient {
MountType mount_type,
const std::string& mount_path);
+ // Returns how many times Unmount() was called.
+ int unmount_call_count() const {
+ return unmount_call_count_;
+ }
+
+ // Returns the |device_path| parameter from the last invocation of Unmount().
+ const std::string& last_unmount_device_path() const {
+ return last_unmount_device_path_;
+ }
+
+ // Returns the |options| parameter from the last invocation of Unmount().
+ UnmountOptions last_unmount_options() const {
+ return last_unmount_options_;
+ }
+
+ // Makes the subsequent Unmount() calls fail. Unmount() succeeds by default.
+ void MakeUnmountFail() {
+ unmount_success_ = false;
+ }
+
+ // Sets a listener callbackif the following Unmount() call is success or not.
+ // Unmount() calls the corresponding callback given as a parameter.
+ void set_unmount_listener(base::Closure listener) {
+ unmount_listener_ = listener;
+ }
+
+ // Returns how many times FormatDevice() was called.
+ int format_device_call_count() const {
+ return format_device_call_count_;
+ }
+
+ // Returns the |device_path| parameter from the last invocation of
+ // FormatDevice().
+ const std::string& last_format_device_device_path() const {
+ return last_format_device_device_path_;
+ }
+
+ // Returns the |filesystem| parameter from the last invocation of
+ // FormatDevice().
+ const std::string& last_format_device_filesystem() const {
+ return last_format_device_filesystem_;
+ }
+
+ // Makes the subsequent FormatDevice() calls fail. FormatDevice() succeeds by
+ // default.
+ void MakeFormatDeviceFail() {
+ format_device_success_ = false;
+ }
+
private:
MountEventHandler mount_event_handler_;
MountCompletedHandler mount_completed_handler_;
+
+ int unmount_call_count_;
+ std::string last_unmount_device_path_;
+ UnmountOptions last_unmount_options_;
+ bool unmount_success_;
+ base::Closure unmount_listener_;
+ int format_device_call_count_;
+ std::string last_format_device_device_path_;
+ std::string last_format_device_filesystem_;
+ bool format_device_success_;
};
} // namespace chromeos