Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chromeos / dbus / fake_cros_disks_client.cc
index 2578077..344a98e 100644 (file)
@@ -13,8 +13,8 @@ namespace chromeos {
 FakeCrosDisksClient::FakeCrosDisksClient()
     : unmount_call_count_(0),
       unmount_success_(true),
-      format_device_call_count_(0),
-      format_device_success_(true) {
+      format_call_count_(0),
+      format_success_(true) {
 }
 
 FakeCrosDisksClient::~FakeCrosDisksClient() {
@@ -51,19 +51,18 @@ void FakeCrosDisksClient::EnumerateAutoMountableDevices(
     const base::Closure& error_callback) {
 }
 
-void FakeCrosDisksClient::FormatDevice(const std::string& device_path,
-                                       const std::string& filesystem,
-                                       const FormatDeviceCallback& callback,
-                                       const base::Closure& error_callback) {
+void FakeCrosDisksClient::Format(const std::string& device_path,
+                                 const std::string& filesystem,
+                                 const base::Closure& callback,
+                                 const base::Closure& error_callback) {
   DCHECK(!callback.is_null());
   DCHECK(!error_callback.is_null());
 
-  format_device_call_count_++;
-  last_format_device_device_path_ = device_path;
-  last_format_device_filesystem_ = filesystem;
-  if (format_device_success_) {
-    base::MessageLoopProxy::current()->PostTask(FROM_HERE,
-                                                base::Bind(callback, true));
+  format_call_count_++;
+  last_format_device_path_ = device_path;
+  last_format_filesystem_ = filesystem;
+  if (format_success_) {
+    base::MessageLoopProxy::current()->PostTask(FROM_HERE, callback);
   } else {
     base::MessageLoopProxy::current()->PostTask(FROM_HERE, error_callback);
   }
@@ -75,13 +74,21 @@ void FakeCrosDisksClient::GetDeviceProperties(
     const base::Closure& error_callback) {
 }
 
-void FakeCrosDisksClient::SetUpConnections(
-    const MountEventHandler& mount_event_handler,
-    const MountCompletedHandler& mount_completed_handler) {
+void FakeCrosDisksClient::SetMountEventHandler(
+    const MountEventHandler& mount_event_handler) {
   mount_event_handler_ = mount_event_handler;
+}
+
+void FakeCrosDisksClient::SetMountCompletedHandler(
+    const MountCompletedHandler& mount_completed_handler) {
   mount_completed_handler_ = mount_completed_handler;
 }
 
+void FakeCrosDisksClient::SetFormatCompletedHandler(
+    const FormatCompletedHandler& format_completed_handler) {
+  format_completed_handler_ = format_completed_handler;
+}
+
 bool FakeCrosDisksClient::SendMountEvent(MountEventType event,
                                          const std::string& path) {
   if (mount_event_handler_.is_null())
@@ -101,4 +108,13 @@ bool FakeCrosDisksClient::SendMountCompletedEvent(
   return true;
 }
 
+bool FakeCrosDisksClient::SendFormatCompletedEvent(
+    FormatError error_code,
+    const std::string& device_path) {
+  if (format_completed_handler_.is_null())
+    return false;
+  format_completed_handler_.Run(error_code, device_path);
+  return true;
+}
+
 }  // namespace chromeos