Home | History | Annotate | Download | only in dbus
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chromeos/dbus/mock_cryptohome_client.h"
      6 
      7 #include "base/bind.h"
      8 #include "base/message_loop/message_loop.h"
      9 
     10 using ::testing::_;
     11 using ::testing::AnyNumber;
     12 using ::testing::Invoke;
     13 
     14 namespace chromeos {
     15 
     16 namespace {
     17 
     18 // Runs callback with true.
     19 void RunCallbackWithTrue(const BoolDBusMethodCallback& callback) {
     20   base::MessageLoop::current()->PostTask(
     21       FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
     22 }
     23 
     24 }  // namespace
     25 
     26 MockCryptohomeClient::MockCryptohomeClient() {
     27   EXPECT_CALL(*this, Init(_)).Times(AnyNumber());
     28   ON_CALL(*this, IsMounted(_))
     29       .WillByDefault(Invoke(&RunCallbackWithTrue));
     30   ON_CALL(*this, InstallAttributesIsReady(_))
     31       .WillByDefault(Invoke(&RunCallbackWithTrue));
     32 }
     33 
     34 MockCryptohomeClient::~MockCryptohomeClient() {}
     35 
     36 }  // namespace chromeos
     37