Apache Mesos
gmock.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License
12 
13 #ifndef __PROCESS_GMOCK_HPP__
14 #define __PROCESS_GMOCK_HPP__
15 
16 #include <gmock/gmock.h>
17 
18 #include <process/dispatch.hpp>
19 #include <process/event.hpp>
20 #include <process/filter.hpp>
21 #include <process/pid.hpp>
22 
23 #include <stout/exit.hpp>
24 #include <stout/nothing.hpp>
25 #include <stout/synchronized.hpp>
26 
27 
28 #define FUTURE_MESSAGE(name, from, to) \
29  process::FutureMessage(name, from, to)
30 
31 #define DROP_MESSAGE(name, from, to) \
32  process::FutureMessage(name, from, to, true)
33 
34 // The mechanism of how we match method dispatches is done by
35 // comparing std::type_info of the member function pointers. Because
36 // of this, the method function pointer passed to either
37 // FUTURE_DISPATCH or DROP_DISPATCH must match exactly the member
38 // function that is passed to the dispatch method.
39 // TODO(tnachen): In a situation where a base class has a virtual
40 // function and that a derived class overrides, and if in unit tests
41 // we want to verify it calls the exact derived member function, we
42 // need to change how dispatch matching works. One possible way is to
43 // move the dispatch matching logic at event dequeue time, as we then
44 // have the actual Process the dispatch event is calling to.
45 #define FUTURE_DISPATCH(pid, method) \
46  process::FutureDispatch(pid, method)
47 
48 #define DROP_DISPATCH(pid, method) \
49  process::FutureDispatch(pid, method, true)
50 
51 #define DROP_MESSAGES(name, from, to) \
52  process::DropMessages(name, from, to)
53 
54 #define EXPECT_NO_FUTURE_MESSAGES(name, from, to) \
55  process::ExpectNoFutureMessages(name, from, to)
56 
57 #define DROP_DISPATCHES(pid, method) \
58  process::DropDispatches(pid, method)
59 
60 #define EXPECT_NO_FUTURE_DISPATCHES(pid, method) \
61  process::ExpectNoFutureDispatches(pid, method)
62 
63 ACTION_TEMPLATE(PromiseArg,
64  HAS_1_TEMPLATE_PARAMS(int, k),
65  AND_1_VALUE_PARAMS(promise))
66 {
67  // TODO(benh): Use a shared_ptr for promise to defend against this
68  // action getting invoked more than once (e.g., used via
69  // WillRepeatedly). We won't be able to set it a second time but at
70  // least we won't get a segmentation fault. We could also consider
71  // warning users if they attempted to set it more than once.
72  promise->set(std::get<k>(args));
73  delete promise;
74 }
75 
76 
77 template <int index, typename T>
78 PromiseArgActionP<index, process::Promise<T>*> FutureArg(
79  process::Future<T>* future)
80 {
82  *future = promise->future();
83  return PromiseArg<index>(promise);
84 }
85 
86 
87 ACTION_TEMPLATE(PromiseArgField,
88  HAS_1_TEMPLATE_PARAMS(int, k),
89  AND_2_VALUE_PARAMS(field, promise))
90 {
91  // TODO(benh): Use a shared_ptr for promise to defend against this
92  // action getting invoked more than once (e.g., used via
93  // WillRepeatedly). We won't be able to set it a second time but at
94  // least we won't get a segmentation fault. We could also consider
95  // warning users if they attempted to set it more than once.
96  promise->set(*(std::get<k>(args).*field));
97  delete promise;
98 }
99 
100 
101 template <int index, typename Field, typename T>
102 PromiseArgFieldActionP2<index, Field, process::Promise<T>*> FutureArgField(
103  Field field,
104  process::Future<T>* future)
105 {
107  *future = promise->future();
108  return PromiseArgField<index>(field, promise);
109 }
110 
111 
112 ACTION_TEMPLATE(PromiseArgNotPointerField,
113  HAS_1_TEMPLATE_PARAMS(int, k),
114  AND_2_VALUE_PARAMS(field, promise))
115 {
116  // TODO(benh): Use a shared_ptr for promise to defend against this
117  // action getting invoked more than once (e.g., used via
118  // WillRepeatedly). We won't be able to set it a second time but at
119  // least we won't get a segmentation fault. We could also consider
120  // warning users if they attempted to set it more than once.
121  promise->set(std::get<k>(args).*field);
122  delete promise;
123 }
124 
125 
126 template <int index, typename Field, typename T>
127 PromiseArgNotPointerFieldActionP2<index, Field, process::Promise<T>*>
129  Field field,
130  process::Future<T>* future)
131 {
133  *future = promise->future();
134  return PromiseArgNotPointerField<index>(field, promise);
135 }
136 
137 
138 ACTION_P2(PromiseSatisfy, promise, value)
139 {
140  promise->set(value);
141  delete promise;
142 }
143 
144 
145 template <typename T>
146 PromiseSatisfyActionP2<process::Promise<T>*, T> FutureSatisfy(
147  process::Future<T>* future,
148  T t)
149 {
151  *future = promise->future();
152  return PromiseSatisfy(promise, t);
153 }
154 
155 
156 inline PromiseSatisfyActionP2<process::Promise<Nothing>*, Nothing>
158 {
160  *future = promise->future();
161  return PromiseSatisfy(promise, Nothing());
162 }
163 
164 
165 // This action invokes an "inner" action but captures the result and
166 // stores a copy of it in a future. Note that this is implemented
167 // similarly to the IgnoreResult action, which relies on the cast
168 // operator to Action<F> which must occur (implicitly) before the
169 // expression has completed, hence we can pass the Future<R>* all the
170 // way through to our action "implementation".
171 template <typename R, typename A>
173 {
174 public:
175  explicit FutureResultAction(process::Future<R>* future, const A& action)
176  : future(future),
177  action(action) {}
178 
179  template <typename F>
180  operator ::testing::Action<F>() const
181  {
182  return ::testing::Action<F>(new Implementation<F>(future, action));
183  }
184 
185 private:
186  template <typename F>
187  class Implementation : public ::testing::ActionInterface<F>
188  {
189  public:
190  explicit Implementation(process::Future<R>* future, const A& action)
191  : action(action)
192  {
193  *future = promise.future();
194  }
195 
196  virtual typename ::testing::ActionInterface<F>::Result Perform(
197  const typename ::testing::ActionInterface<F>::ArgumentTuple& args)
198  {
199  const typename ::testing::ActionInterface<F>::Result result =
200  action.Perform(args);
201  promise.set(result);
202  return result;
203  }
204 
205  private:
206  // Not copyable, not assignable.
207  Implementation(const Implementation&);
208  Implementation& operator=(const Implementation&);
209 
211  const ::testing::Action<F> action;
212  };
213 
214  process::Future<R>* future;
215  const A action;
216 };
217 
218 
219 template <typename R, typename A>
221  process::Future<R>* future,
222  const A& action)
223 {
224  return FutureResultAction<R, A>(future, action);
225 }
226 
227 
228 namespace process {
229 
230 class MockFilter : public Filter
231 {
232 public:
234  {
235  EXPECT_CALL(*this, filter(testing::A<const MessageEvent&>()))
236  .WillRepeatedly(testing::Return(false));
237  EXPECT_CALL(*this, filter(testing::A<const DispatchEvent&>()))
238  .WillRepeatedly(testing::Return(false));
239  EXPECT_CALL(*this, filter(testing::A<const HttpEvent&>()))
240  .WillRepeatedly(testing::Return(false));
241  EXPECT_CALL(*this, filter(testing::A<const ExitedEvent&>()))
242  .WillRepeatedly(testing::Return(false));
243  }
244 
245  MOCK_METHOD1(filter, bool(const MessageEvent&));
246  MOCK_METHOD1(filter, bool(const DispatchEvent&));
247  MOCK_METHOD1(filter, bool(const HttpEvent&));
248  MOCK_METHOD1(filter, bool(const ExitedEvent&));
249 };
250 
251 
252 // A definition of a libprocess filter to enable waiting for events
253 // (such as messages or dispatches) via in tests. This is not meant to
254 // be used directly by tests; tests should use macros like
255 // FUTURE_MESSAGE and FUTURE_DISPATCH instead.
256 class TestsFilter : public Filter
257 {
258 public:
259  TestsFilter() = default;
260 
261  virtual bool filter(const MessageEvent& event) { return handle(event); }
262  virtual bool filter(const DispatchEvent& event) { return handle(event); }
263  virtual bool filter(const HttpEvent& event) { return handle(event); }
264  virtual bool filter(const ExitedEvent& event) { return handle(event); }
265 
266  template <typename T>
267  bool handle(const T& t)
268  {
269  synchronized (mutex) {
270  return mock.filter(t);
271  }
272  }
273 
275 
276  // We use a recursive mutex here in the event that satisfying the
277  // future created in FutureMessage or FutureDispatch via the
278  // FutureArgField or FutureSatisfy actions invokes callbacks (from
279  // Future::then or Future::onAny, etc) that themselves invoke
280  // FutureDispatch or FutureMessage.
281  std::recursive_mutex mutex;
282 };
283 
284 
285 class FilterTestEventListener : public ::testing::EmptyTestEventListener
286 {
287 public:
288  // Returns the singleton instance of the listener.
290  {
291  static FilterTestEventListener* listener = new FilterTestEventListener();
292  return listener;
293  }
294 
295  // Installs and returns the filter, creating it if necessary.
297  {
298  if (!started) {
299  EXIT(EXIT_FAILURE)
300  << "To use FUTURE/DROP_MESSAGE/DISPATCH, etc. you need to do the "
301  << "following before you invoke RUN_ALL_TESTS():\n\n"
302  << "\t::testing::TestEventListeners& listeners =\n"
303  << "\t ::testing::UnitTest::GetInstance()->listeners();\n"
304  << "\tlisteners.Append(process::FilterTestEventListener::instance());";
305  }
306 
307  if (filter != nullptr) {
308  return filter;
309  }
310 
311  filter = new TestsFilter();
312 
313  // Set the filter in libprocess.
315 
316  return filter;
317  }
318 
319  virtual void OnTestProgramStart(const ::testing::UnitTest&)
320  {
321  started = true;
322  }
323 
324  virtual void OnTestEnd(const ::testing::TestInfo&)
325  {
326  if (filter != nullptr) {
327  // Remove the filter in libprocess _before_ deleting.
328  process::filter(nullptr);
329  delete filter;
330  filter = nullptr;
331  }
332  }
333 
334 private:
335  FilterTestEventListener() : filter(nullptr), started(false) {}
336 
338 
339  // Indicates if we got the OnTestProgramStart callback in order to
340  // detect if we have been properly added as a listener.
341  bool started;
342 };
343 
344 
345 MATCHER_P3(MessageMatcher, name, from, to, "")
346 {
347  const MessageEvent& event = ::std::get<0>(arg);
348  return (testing::Matcher<std::string>(name).Matches(event.message.name) &&
349  testing::Matcher<UPID>(from).Matches(event.message.from) &&
350  testing::Matcher<UPID>(to).Matches(event.message.to));
351 }
352 
353 
354 // This matches protobuf messages that are described using the
355 // standard protocol buffer "union" trick, see:
356 // https://developers.google.com/protocol-buffers/docs/techniques#union.
357 MATCHER_P4(UnionMessageMatcher, message, unionType, from, to, "")
358 {
359  const process::MessageEvent& event = ::std::get<0>(arg);
360  message_type message;
361 
362  return (testing::Matcher<std::string>(message.GetTypeName()).Matches(
363  event.message.name) &&
364  message.ParseFromString(event.message.body) &&
365  testing::Matcher<unionType_type>(unionType).Matches(message.type()) &&
366  testing::Matcher<process::UPID>(from).Matches(event.message.from) &&
367  testing::Matcher<process::UPID>(to).Matches(event.message.to));
368 }
369 
370 
371 MATCHER_P2(DispatchMatcher, pid, method, "")
372 {
373  const DispatchEvent& event = ::std::get<0>(arg);
374  return (testing::Matcher<UPID>(pid).Matches(event.pid) &&
375  event.functionType.isSome() &&
376  *event.functionType.get() == typeid(method));
377 }
378 
379 
380 MATCHER_P3(HttpMatcher, message, path, deserializer, "")
381 {
382  const HttpEvent& event = ::std::get<0>(arg);
383 
384  Try<message_type> message_ = deserializer(event.request->body);
385  if (message_.isError()) {
386  return false;
387  }
388 
389  return (testing::Matcher<std::string>(path).Matches(event.request->url.path));
390 }
391 
392 
393 // See `UnionMessageMatcher` for more details on protobuf messages using the
394 // "union" trick.
395 MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer, "")
396 {
397  const HttpEvent& event = ::std::get<0>(arg);
398 
399  Try<message_type> message_ = deserializer(event.request->body);
400  if (message_.isError()) {
401  return false;
402  }
403 
404  return (
405  testing::Matcher<unionType_type>(unionType).Matches(message_->type()) &&
406  testing::Matcher<std::string>(path).Matches(event.request->url.path));
407 }
408 
409 
410 template <typename Message, typename Path, typename Deserializer>
412  Message message,
413  Path path,
414  Deserializer deserializer,
415  bool drop = false)
416 {
417  TestsFilter* filter = FilterTestEventListener::instance()->install();
418  Future<http::Request> future;
419  synchronized (filter->mutex) {
420  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
421  .With(HttpMatcher(message, path, deserializer))
422  .WillOnce(testing::DoAll(FutureArgField<0>(
424  &future),
425  testing::Return(drop)))
426  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
427  }
428 
429  return future;
430 }
431 
432 
433 template <typename Message,
434  typename UnionType,
435  typename Path,
436  typename Deserializer>
438  Message message,
439  UnionType unionType,
440  Path path,
441  Deserializer deserializer,
442  bool drop = false)
443 {
444  TestsFilter* filter = FilterTestEventListener::instance()->install();
445  Future<http::Request> future;
446  synchronized (filter->mutex) {
447  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
448  .With(UnionHttpMatcher(message, unionType, path, deserializer))
449  .WillOnce(testing::DoAll(FutureArgField<0>(
451  &future),
452  testing::Return(drop)))
453  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
454  }
455 
456  return future;
457 }
458 
459 
460 template <typename Name, typename From, typename To>
461 Future<Message> FutureMessage(Name name, From from, To to, bool drop = false)
462 {
463  TestsFilter* filter = FilterTestEventListener::instance()->install();
464  Future<Message> future;
465  synchronized (filter->mutex) {
466  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
467  .With(MessageMatcher(name, from, to))
468  .WillOnce(testing::DoAll(FutureArgNotPointerField<0>(
469  &MessageEvent::message,
470  &future),
471  testing::Return(drop)))
472  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
473  }
474 
475  return future;
476 }
477 
478 
479 template <typename Message, typename UnionType, typename From, typename To>
481  Message message, UnionType unionType, From from, To to, bool drop = false)
482 {
484  FilterTestEventListener::instance()->install();
485 
487  synchronized (filter->mutex) {
488  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
489  .With(UnionMessageMatcher(message, unionType, from, to))
490  .WillOnce(testing::DoAll(FutureArgNotPointerField<0>(
491  &MessageEvent::message,
492  &future),
493  testing::Return(drop)))
494  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
495  }
496 
497  return future;
498 }
499 
500 
501 template <typename PID, typename Method>
502 Future<Nothing> FutureDispatch(PID pid, Method method, bool drop = false)
503 {
504  TestsFilter* filter = FilterTestEventListener::instance()->install();
505  Future<Nothing> future;
506  synchronized (filter->mutex) {
507  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
508  .With(DispatchMatcher(pid, method))
509  .WillOnce(testing::DoAll(FutureSatisfy(&future),
510  testing::Return(drop)))
511  .RetiresOnSaturation(); // Don't impose any subsequent expectations.
512  }
513 
514  return future;
515 }
516 
517 
518 template <typename Name, typename From, typename To>
519 void DropMessages(Name name, From from, To to)
520 {
521  TestsFilter* filter = FilterTestEventListener::instance()->install();
522  synchronized (filter->mutex) {
523  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
524  .With(MessageMatcher(name, from, to))
525  .WillRepeatedly(testing::Return(true));
526  }
527 }
528 
529 
530 template <typename Message, typename UnionType, typename From, typename To>
531 void DropUnionMessages(Message message, UnionType unionType, From from, To to)
532 {
533  TestsFilter* filter = FilterTestEventListener::instance()->install();
534  synchronized (filter->mutex) {
535  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
536  .With(UnionMessageMatcher(message, unionType, from, to))
537  .WillRepeatedly(testing::Return(true));
538  }
539 }
540 
541 
542 template <typename Message, typename Path, typename Deserializer>
544  Message message,
545  Path path,
546  Deserializer deserializer,
547  bool drop = false)
548 {
549  TestsFilter* filter = FilterTestEventListener::instance()->install();
550  synchronized (filter->mutex) {
551  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
552  .With(HttpMatcher(message, path, deserializer))
553  .WillRepeatedly(testing::Return(true));
554  }
555 }
556 
557 
558 template <typename Message,
559  typename UnionType,
560  typename Path,
561  typename Deserializer>
563  Message message,
564  UnionType unionType,
565  Path path,
566  Deserializer deserializer,
567  bool drop = false)
568 {
569  TestsFilter* filter = FilterTestEventListener::instance()->install();
570  Future<http::Request> future;
571  synchronized (filter->mutex) {
572  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
573  .With(UnionHttpMatcher(message, unionType, path, deserializer))
574  .WillRepeatedly(testing::Return(true));
575  }
576 }
577 
578 
579 template <typename Message, typename Path, typename Deserializer>
581  Message message,
582  Path path,
583  Deserializer deserializer,
584  bool drop = false)
585 {
586  TestsFilter* filter = FilterTestEventListener::instance()->install();
587  synchronized (filter->mutex) {
588  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
589  .With(HttpMatcher(message, path, deserializer))
590  .Times(0);
591  }
592 }
593 
594 
595 template <typename Message,
596  typename UnionType,
597  typename Path,
598  typename Deserializer>
600  Message message,
601  UnionType unionType,
602  Path path,
603  Deserializer deserializer,
604  bool drop = false)
605 {
606  TestsFilter* filter = FilterTestEventListener::instance()->install();
607  Future<http::Request> future;
608  synchronized (filter->mutex) {
609  EXPECT_CALL(filter->mock, filter(testing::A<const HttpEvent&>()))
610  .With(UnionHttpMatcher(message, unionType, path, deserializer))
611  .Times(0);
612  }
613 }
614 
615 
616 template <typename Name, typename From, typename To>
617 void ExpectNoFutureMessages(Name name, From from, To to)
618 {
619  TestsFilter* filter = FilterTestEventListener::instance()->install();
620  synchronized (filter->mutex) {
621  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
622  .With(MessageMatcher(name, from, to))
623  .Times(0);
624  }
625 }
626 
627 
628 template <typename Message, typename UnionType, typename From, typename To>
630  Message message, UnionType unionType, From from, To to)
631 {
632  TestsFilter* filter = FilterTestEventListener::instance()->install();
633  synchronized (filter->mutex) {
634  EXPECT_CALL(filter->mock, filter(testing::A<const MessageEvent&>()))
635  .With(UnionMessageMatcher(message, unionType, from, to))
636  .Times(0);
637  }
638 }
639 
640 
641 template <typename PID, typename Method>
642 void DropDispatches(PID pid, Method method)
643 {
644  TestsFilter* filter = FilterTestEventListener::instance()->install();
645  synchronized (filter->mutex) {
646  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
647  .With(DispatchMatcher(pid, method))
648  .WillRepeatedly(testing::Return(true));
649  }
650 }
651 
652 
653 template <typename PID, typename Method>
654 void ExpectNoFutureDispatches(PID pid, Method method)
655 {
656  TestsFilter* filter = FilterTestEventListener::instance()->install();
657  synchronized (filter->mutex) {
658  EXPECT_CALL(filter->mock, filter(testing::A<const DispatchEvent&>()))
659  .With(DispatchMatcher(pid, method))
660  .Times(0);
661  }
662 }
663 
664 } // namespace process {
665 
666 #endif // __PROCESS_GMOCK_HPP__
Definition: filter.hpp:20
Definition: path.hpp:26
virtual bool filter(const HttpEvent &event)
Definition: gmock.hpp:263
Future< process::Message > FutureUnionMessage(Message message, UnionType unionType, From from, To to, bool drop=false)
Definition: gmock.hpp:480
Definition: nothing.hpp:16
PromiseArgActionP< index, process::Promise< T > * > FutureArg(process::Future< T > *future)
Definition: gmock.hpp:78
Definition: gmock.hpp:172
Future< Response > request(const Request &request, bool streamedResponse=false)
Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire res...
FutureResultAction(process::Future< R > *future, const A &action)
Definition: gmock.hpp:175
MATCHER_P3(HttpMatcher, message, path, deserializer,"")
Definition: gmock.hpp:380
Definition: check.hpp:33
MATCHER_P4(UnionHttpMatcher, message, unionType, path, deserializer,"")
Definition: gmock.hpp:395
virtual void OnTestProgramStart(const ::testing::UnitTest &)
Definition: gmock.hpp:319
Definition: event.hpp:142
void ExpectNoFutureUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:629
Definition: message.hpp:22
PromiseSatisfyActionP2< process::Promise< T > *, T > FutureSatisfy(process::Future< T > *future, T t)
Definition: gmock.hpp:146
virtual bool filter(const MessageEvent &event)
Definition: gmock.hpp:261
Definition: event.hpp:178
#define EXIT(status)
Definition: exit.hpp:31
void DropUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:562
MockFilter mock
Definition: gmock.hpp:274
virtual void OnTestEnd(const ::testing::TestInfo &)
Definition: gmock.hpp:324
Definition: event.hpp:214
Future< Nothing > FutureDispatch(PID pid, Method method, bool drop=false)
Definition: gmock.hpp:502
PromiseArgNotPointerFieldActionP2< index, Field, process::Promise< T > * > FutureArgNotPointerField(Field field, process::Future< T > *future)
Definition: gmock.hpp:128
void DropHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:543
ACTION_P2(PromiseSatisfy, promise, value)
Definition: gmock.hpp:138
PromiseArgFieldActionP2< index, Field, process::Promise< T > * > FutureArgField(Field field, process::Future< T > *future)
Definition: gmock.hpp:102
void DropUnionMessages(Message message, UnionType unionType, From from, To to)
Definition: gmock.hpp:531
TestsFilter * install()
Definition: gmock.hpp:296
MockFilter()
Definition: gmock.hpp:233
Represents a POSIX or Windows file system path and offers common path manipulations.
Definition: path.hpp:145
Definition: future.hpp:73
void DropDispatches(PID pid, Method method)
Definition: gmock.hpp:642
virtual bool filter(const DispatchEvent &event)
Definition: gmock.hpp:262
Protocol< PromiseRequest, PromiseResponse > promise
std::recursive_mutex mutex
Definition: gmock.hpp:281
Future< Message > FutureMessage(Name name, From from, To to, bool drop=false)
Definition: gmock.hpp:461
FutureResultAction< R, A > FutureResult(process::Future< R > *future, const A &action)
Definition: gmock.hpp:220
void ExpectNoFutureUnionHttpRequests(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:599
A "process identifier" used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:279
void ExpectNoFutureMessages(Name name, From from, To to)
Definition: gmock.hpp:617
virtual bool filter(const ExitedEvent &event)
Definition: gmock.hpp:264
Definition: executor.hpp:47
static FilterTestEventListener * instance()
Definition: gmock.hpp:289
Future< T > future() const
Definition: future.hpp:913
Future< http::Request > FutureUnionHttpRequest(Message message, UnionType unionType, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:437
Definition: event.hpp:103
Definition: gmock.hpp:230
Definition: gmock.hpp:285
void ExpectNoFutureDispatches(PID pid, Method method)
Definition: gmock.hpp:654
Definition: gmock.hpp:256
ACTION_TEMPLATE(PromiseArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(promise))
Definition: gmock.hpp:63
void ExpectNoFutureHttpRequests(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:580
Future< http::Request > FutureHttpRequest(Message message, Path path, Deserializer deserializer, bool drop=false)
Definition: gmock.hpp:411
constexpr const char * name
Definition: shell.hpp:43
MATCHER_P2(DispatchMatcher, pid, method,"")
Definition: gmock.hpp:371
void filter(Filter *filter)
bool handle(const T &t)
Definition: gmock.hpp:267
void DropMessages(Name name, From from, To to)
Definition: gmock.hpp:519
Definition: future.hpp:57