Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: remoting/host/mock_callback.h

Issue 734053003: Reporting of policy errors via host-offline-reason: part 2b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hor-nohoststatussender
Patch Set: Switched to base::Unretained in mock_callback.h Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef REMOTING_HOST_MOCK_CALLBACK_H_
6 #define REMOTING_HOST_MOCK_CALLBACK_H_
7
8 // TODO(lukasza): If possible, move this header file to base/mock_callback.h
9
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/callback.h"
13
14 #include "testing/gmock/include/gmock/gmock.h"
15
16 namespace remoting {
17
18 template <typename Sig>
19 class MockCallback;
20
21 template <typename R>
22 class MockCallback<R()> {
23 public:
24 MOCK_CONST_METHOD0_T(Run, R());
25
26 MockCallback() {
27 }
28
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));
33 }
34
35 private:
36 DISALLOW_COPY_AND_ASSIGN(MockCallback);
37 };
38
39 typedef MockCallback<void(void)> MockClosure;
40
41 } // namespace remoting
42
43 #endif // REMOTING_HOST_MOCK_CALLBACK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698