| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MOCK_CROS_DISKS_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_MOCK_CROS_DISKS_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_MOCK_CROS_DISKS_CLIENT_H_ | 6 #define CHROMEOS_DBUS_MOCK_CROS_DISKS_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chromeos/dbus/cros_disks_client.h" | 10 #include "chromeos/dbus/cros_disks_client.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 MOCK_METHOD2(EnumerateAutoMountableDevices, | 30 MOCK_METHOD2(EnumerateAutoMountableDevices, |
| 31 void(const EnumerateAutoMountableDevicesCallback&, | 31 void(const EnumerateAutoMountableDevicesCallback&, |
| 32 const ErrorCallback&)); | 32 const ErrorCallback&)); |
| 33 MOCK_METHOD4(FormatDevice, void(const std::string&, | 33 MOCK_METHOD4(FormatDevice, void(const std::string&, |
| 34 const std::string&, | 34 const std::string&, |
| 35 const FormatDeviceCallback&, | 35 const FormatDeviceCallback&, |
| 36 const ErrorCallback&)); | 36 const ErrorCallback&)); |
| 37 MOCK_METHOD3(GetDeviceProperties, void(const std::string&, | 37 MOCK_METHOD3(GetDeviceProperties, void(const std::string&, |
| 38 const GetDevicePropertiesCallback&, | 38 const GetDevicePropertiesCallback&, |
| 39 const ErrorCallback&)); | 39 const ErrorCallback&)); |
| 40 // Warning: if this method is mocked, SendMountEvent and |
| 41 // SendMountCompletedEvent may not work. |
| 40 MOCK_METHOD2(SetUpConnections, void(const MountEventHandler&, | 42 MOCK_METHOD2(SetUpConnections, void(const MountEventHandler&, |
| 41 const MountCompletedHandler&)); | 43 const MountCompletedHandler&)); |
| 44 |
| 45 // Used to simulate signals sent by cros disks layer. |
| 46 // Invokes handlers set in |SetUpConnections|. |
| 47 bool SendMountEvent(MountEventType event, const std::string& path); |
| 48 bool SendMountCompletedEvent(MountError error_code, |
| 49 const std::string& source_path, |
| 50 MountType mount_type, |
| 51 const std::string& mount_path); |
| 52 |
| 53 private: |
| 54 // Default implementation of SetupConnections. |
| 55 // Sets internal MounteEvent and MountCompleted handlers. |
| 56 void SetUpConnectionsInternal( |
| 57 const MountEventHandler& mount_event_handler, |
| 58 const MountCompletedHandler& mount_completed_handler); |
| 59 |
| 60 MountEventHandler mount_event_handler_; |
| 61 MountCompletedHandler mount_completed_handler_; |
| 42 }; | 62 }; |
| 43 | 63 |
| 44 } // namespace chromeos | 64 } // namespace chromeos |
| 45 | 65 |
| 46 #endif // CHROMEOS_DBUS_MOCK_CROS_DISKS_CLIENT_H_ | 66 #endif // CHROMEOS_DBUS_MOCK_CROS_DISKS_CLIENT_H_ |
| OLD | NEW |