summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/mock_cryptohome_client.cc
blob: 60927c14b2adeebfb9c5efa971b268fb2ff73d3f (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
// 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_cryptohome_client.h"

#include "base/bind.h"
#include "base/message_loop.h"

using ::testing::Invoke;
using ::testing::_;

namespace chromeos {

namespace {

// Runs callback with true.
void RunCallbackWithTrue(const BoolDBusMethodCallback& callback) {
  MessageLoop::current()->PostTask(
      FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
}

}  // namespace

MockCryptohomeClient::MockCryptohomeClient() {
  ON_CALL(*this, IsMounted(_))
      .WillByDefault(Invoke(&RunCallbackWithTrue));
  ON_CALL(*this, InstallAttributesIsReady(_))
      .WillByDefault(Invoke(&RunCallbackWithTrue));
}

MockCryptohomeClient::~MockCryptohomeClient() {}

}  // namespace chromeos