blob: c56d1075490e610e8e06d41c7ee7ac9181dc5129 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/dbus/mock_cros_disks_client.h"
using testing::_;
using testing::Invoke;
namespace chromeos {
MockCrosDisksClient::MockCrosDisksClient() {
ON_CALL(*this, SetUpConnections(_, _))
.WillByDefault(Invoke(this,
&MockCrosDisksClient::SetUpConnectionsInternal));
}
MockCrosDisksClient::~MockCrosDisksClient() {}
bool MockCrosDisksClient::SendMountEvent(MountEventType event,
const std::string& path) {
if (mount_event_handler_.is_null())
return false;
mount_event_handler_.Run(event, path);
return true;
}
bool MockCrosDisksClient::SendMountCompletedEvent(
MountError error_code,
const std::string& source_path,
MountType mount_type,
const std::string& mount_path) {
if (mount_completed_handler_.is_null())
return false;
mount_completed_handler_.Run(error_code, source_path, mount_type, mount_path);
return true;
}
void MockCrosDisksClient::SetUpConnectionsInternal(
const MountEventHandler& mount_event_handler,
const MountCompletedHandler& mount_completed_handler) {
mount_event_handler_ = mount_event_handler;
mount_completed_handler_ = mount_completed_handler;
}
} // namespace chromeos
|