Enable disabling WebCore::GraphicsContext in telemetry.
[chromium-blink-merge.git] / chromeos / cryptohome / mock_homedir_methods.cc
blob0cb4a387bc30838bce3cc57cee66a047767ba398
1 // Copyright 2014 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.
5 #include "chromeos/cryptohome/mock_homedir_methods.h"
7 #include "chromeos/cryptohome/mock_async_method_caller.h"
9 using ::testing::Invoke;
10 using ::testing::WithArgs;
11 using ::testing::_;
13 namespace cryptohome {
15 MockHomedirMethods::MockHomedirMethods()
16 : success_(false), return_code_(cryptohome::MOUNT_ERROR_NONE) {}
18 MockHomedirMethods::~MockHomedirMethods() {}
20 void MockHomedirMethods::SetUp(bool success, MountError return_code) {
21 success_ = success;
22 return_code_ = return_code;
23 ON_CALL(*this, CheckKeyEx(_, _, _)).WillByDefault(
24 WithArgs<2>(Invoke(this, &MockHomedirMethods::DoCallback)));
25 ON_CALL(*this, MountEx(_, _, _, _)).WillByDefault(
26 WithArgs<3>(Invoke(this, &MockHomedirMethods::DoMountCallback)));
27 ON_CALL(*this, AddKeyEx(_, _, _, _, _)).WillByDefault(
28 WithArgs<4>(Invoke(this, &MockHomedirMethods::DoCallback)));
29 ON_CALL(*this, UpdateKeyEx(_, _, _, _, _)).WillByDefault(
30 WithArgs<4>(Invoke(this, &MockHomedirMethods::DoCallback)));
31 ON_CALL(*this, RemoveKeyEx(_, _, _, _)).WillByDefault(
32 WithArgs<3>(Invoke(this, &MockHomedirMethods::DoCallback)));
35 void MockHomedirMethods::DoCallback(const Callback& callback) {
36 callback.Run(success_, return_code_);
39 void MockHomedirMethods::DoMountCallback(const MountCallback& callback) {
40 callback.Run(
41 success_, return_code_, MockAsyncMethodCaller::kFakeSanitizedUsername);
44 } // namespace cryptohome