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

Unified 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: Rebasing... 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/heartbeat_sender_unittest.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/mock_callback.h
diff --git a/remoting/host/mock_callback.h b/remoting/host/mock_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..ca3feb6d06a415f1853b363e7b089f8b0a03ad7a
--- /dev/null
+++ b/remoting/host/mock_callback.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_MOCK_CALLBACK_H_
+#define REMOTING_HOST_MOCK_CALLBACK_H_
+
+// TODO(lukasza): If possible, move this header file to base/mock_callback.h
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/callback.h"
+
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace remoting {
+
+template <typename Sig>
+class MockCallback;
+
+template <typename R>
+class MockCallback<R()> {
+ public:
+ MOCK_CONST_METHOD0_T(Run, R());
+
+ MockCallback() {
+ }
+
+ // Caller of GetCallback has to guarantee that the returned callback
+ // will not be run after |this| is destroyed.
+ base::Callback<R()> GetCallback() {
+ return base::Bind(&MockCallback<R()>::Run, base::Unretained(this));
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockCallback);
+};
+
+typedef MockCallback<void(void)> MockClosure;
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_MOCK_CALLBACK_H_
« no previous file with comments | « remoting/host/heartbeat_sender_unittest.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698