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 #include "chromeos/dbus/mock_cros_disks_client.h" | 5 #include "chromeos/dbus/mock_cros_disks_client.h" |
6 | 6 |
| 7 using testing::_; |
| 8 using testing::Invoke; |
| 9 |
7 namespace chromeos { | 10 namespace chromeos { |
8 | 11 |
9 MockCrosDisksClient::MockCrosDisksClient() {} | 12 MockCrosDisksClient::MockCrosDisksClient() { |
| 13 ON_CALL(*this, SetUpConnections(_, _)) |
| 14 .WillByDefault(Invoke(this, |
| 15 &MockCrosDisksClient::SetUpConnectionsInternal)); |
| 16 } |
10 | 17 |
11 MockCrosDisksClient::~MockCrosDisksClient() {} | 18 MockCrosDisksClient::~MockCrosDisksClient() {} |
12 | 19 |
| 20 bool MockCrosDisksClient::SendMountEvent(MountEventType event, |
| 21 const std::string& path) { |
| 22 if (mount_event_handler_.is_null()) |
| 23 return false; |
| 24 mount_event_handler_.Run(event, path); |
| 25 return true; |
| 26 } |
| 27 |
| 28 bool MockCrosDisksClient::SendMountCompletedEvent( |
| 29 MountError error_code, |
| 30 const std::string& source_path, |
| 31 MountType mount_type, |
| 32 const std::string& mount_path) { |
| 33 if (mount_completed_handler_.is_null()) |
| 34 return false; |
| 35 mount_completed_handler_.Run(error_code, source_path, mount_type, mount_path); |
| 36 return true; |
| 37 } |
| 38 |
| 39 void MockCrosDisksClient::SetUpConnectionsInternal( |
| 40 const MountEventHandler& mount_event_handler, |
| 41 const MountCompletedHandler& mount_completed_handler) { |
| 42 mount_event_handler_ = mount_event_handler; |
| 43 mount_completed_handler_ = mount_completed_handler; |
| 44 } |
| 45 |
13 } // namespace chromeos | 46 } // namespace chromeos |
OLD | NEW |