You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/02/16 15:32:45 UTC

[3/3] mesos git commit: Added EXPECT_NO_FUTURE_DISPATCHES to libprocess.

Added EXPECT_NO_FUTURE_DISPATCHES to libprocess.

This allows a unit test to assert that a given libprocess message
will not be dispatched.

Review: https://reviews.apache.org/r/43034/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cf801e78
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cf801e78
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cf801e78

Branch: refs/heads/master
Commit: cf801e78f2844855e19f025ebdf54dccbc4c28a9
Parents: 01fb5e1
Author: Neil Conway <ne...@gmail.com>
Authored: Tue Feb 16 09:10:42 2016 -0500
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Feb 16 09:32:26 2016 -0500

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/gmock.hpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cf801e78/3rdparty/libprocess/include/process/gmock.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/gmock.hpp b/3rdparty/libprocess/include/process/gmock.hpp
index 22a0eac..15b982f 100644
--- a/3rdparty/libprocess/include/process/gmock.hpp
+++ b/3rdparty/libprocess/include/process/gmock.hpp
@@ -62,6 +62,8 @@
 #define DROP_DISPATCHES(pid, method)            \
   process::DropDispatches(pid, method)
 
+#define EXPECT_NO_FUTURE_DISPATCHES(pid, method)        \
+  process::ExpectNoFutureDispatches(pid, method)
 
 ACTION_TEMPLATE(PromiseArg,
                 HAS_1_TEMPLATE_PARAMS(int, k),
@@ -627,6 +629,18 @@ void DropDispatches(PID pid, Method method)
   }
 }
 
+
+template <typename PID, typename Method>
+void ExpectNoFutureDispatches(PID pid, Method method)
+{
+  TestsFilter* filter = FilterTestEventListener::instance()->install();
+  synchronized (filter->mutex) {
+    EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
+      .With(DispatchMatcher(pid, method))
+      .Times(0);
+  }
+}
+
 } // namespace process {
 
 #endif // __PROCESS_GMOCK_HPP__