forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
47 lines (37 loc) · 1.01 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "envoy/common/time.h"
#include "gmock/gmock.h"
namespace Envoy {
/**
* This action allows us to save a reference parameter to a pointer target.
*/
ACTION_P(SaveArgAddress, target) { *target = &arg0; }
/**
* Matcher that matches on whether the pointee of both lhs and rhs are equal.
*/
MATCHER_P(PointeesEq, rhs, "") {
*result_listener << testing::PrintToString(*arg) + " != " + testing::PrintToString(*rhs);
return *arg == *rhs;
}
/**
* Simple mock that just lets us make sure a method gets called or not called form a lambda.
*/
class ReadyWatcher {
public:
ReadyWatcher();
~ReadyWatcher();
MOCK_METHOD0(ready, void());
};
class MockSystemTimeSource : public SystemTimeSource {
public:
MockSystemTimeSource();
~MockSystemTimeSource();
MOCK_METHOD0(currentTime, SystemTime());
};
class MockMonotonicTimeSource : public MonotonicTimeSource {
public:
MockMonotonicTimeSource();
~MockMonotonicTimeSource();
MOCK_METHOD0(currentTime, MonotonicTime());
};
} // namespace Envoy