| OLD | NEW |
| (Empty) |
| 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 "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" | |
| 6 | |
| 7 using ::testing::Invoke; | |
| 8 using ::testing::WithArgs; | |
| 9 using ::testing::_; | |
| 10 | |
| 11 namespace cryptohome { | |
| 12 | |
| 13 MockAsyncMethodCaller::MockAsyncMethodCaller() | |
| 14 : success_(false), return_code_(cryptohome::MOUNT_ERROR_NONE) { | |
| 15 } | |
| 16 | |
| 17 MockAsyncMethodCaller::~MockAsyncMethodCaller() {} | |
| 18 | |
| 19 void MockAsyncMethodCaller::SetUp(bool success, MountError return_code) { | |
| 20 success_ = success; | |
| 21 return_code_ = return_code; | |
| 22 ON_CALL(*this, AsyncCheckKey(_, _, _)) | |
| 23 .WillByDefault( | |
| 24 WithArgs<2>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | |
| 25 ON_CALL(*this, AsyncMigrateKey(_, _, _, _)) | |
| 26 .WillByDefault( | |
| 27 WithArgs<3>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | |
| 28 ON_CALL(*this, AsyncMount(_, _, _, _)) | |
| 29 .WillByDefault( | |
| 30 WithArgs<3>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | |
| 31 ON_CALL(*this, AsyncMountGuest(_)) | |
| 32 .WillByDefault( | |
| 33 WithArgs<0>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | |
| 34 ON_CALL(*this, AsyncRemove(_, _)) | |
| 35 .WillByDefault( | |
| 36 WithArgs<1>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | |
| 37 } | |
| 38 | |
| 39 void MockAsyncMethodCaller::DoCallback(Callback callback) { | |
| 40 callback.Run(success_, return_code_); | |
| 41 } | |
| 42 | |
| 43 | |
| 44 } // namespace cryptohome | |
| OLD | NEW |