GN + Android: extract android_standalone_library rule.
[chromium-blink-merge.git] / remoting / host / mock_callback.h
blobca3feb6d06a415f1853b363e7b089f8b0a03ad7a
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 #ifndef REMOTING_HOST_MOCK_CALLBACK_H_
6 #define REMOTING_HOST_MOCK_CALLBACK_H_
8 // TODO(lukasza): If possible, move this header file to base/mock_callback.h
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/callback.h"
14 #include "testing/gmock/include/gmock/gmock.h"
16 namespace remoting {
18 template <typename Sig>
19 class MockCallback;
21 template <typename R>
22 class MockCallback<R()> {
23 public:
24 MOCK_CONST_METHOD0_T(Run, R());
26 MockCallback() {
29 // Caller of GetCallback has to guarantee that the returned callback
30 // will not be run after |this| is destroyed.
31 base::Callback<R()> GetCallback() {
32 return base::Bind(&MockCallback<R()>::Run, base::Unretained(this));
35 private:
36 DISALLOW_COPY_AND_ASSIGN(MockCallback);
39 typedef MockCallback<void(void)> MockClosure;
41 } // namespace remoting
43 #endif // REMOTING_HOST_MOCK_CALLBACK_H_