proxygen
TestTimeout Class Reference
Inheritance diagram for TestTimeout:
proxygen::AsyncTimeoutSet::Callback folly::AsyncTimeout TestTimeoutDelayed TestTimeoutDelayed

Public Member Functions

 TestTimeout (EventBase *eventBase)
 
void timeoutExpired () noexceptoverride
 
 TestTimeout ()
 
 TestTimeout (HHWheelTimer *t, milliseconds timeout)
 
void timeoutExpired () noexceptoverride
 
void callbackCanceled () noexceptoverride
 
 TestTimeout ()
 
 TestTimeout (HHWheelTimer *t, milliseconds timeout)
 
void timeoutExpired () noexceptoverride
 
void callbackCanceled () noexceptoverride
 
template<typename... Args>
 TestTimeout (Args &&...args)
 
 TestTimeout ()
 
void addTimeout (AsyncTimeoutSet *set)
 
template<typename... Args>
void addTimeout (AsyncTimeoutSet *set, Args &&...args)
 
void timeoutExpired () noexceptoverride
 
void _scheduleNext ()
 
- Public Member Functions inherited from proxygen::AsyncTimeoutSet::Callback
 Callback ()
 
virtual ~Callback ()
 
void cancelTimeout ()
 
bool isScheduled () const
 
- Public Member Functions inherited from folly::AsyncTimeout
 AsyncTimeout (TimeoutManager *timeoutManager)
 
 AsyncTimeout (EventBase *eventBase)
 
 AsyncTimeout (TimeoutManager *timeoutManager, InternalEnum internal)
 
 AsyncTimeout (EventBase *eventBase, InternalEnum internal)
 
 AsyncTimeout ()
 
virtual ~AsyncTimeout ()
 
bool scheduleTimeout (uint32_t milliseconds)
 
bool scheduleTimeout (TimeoutManager::timeout_type timeout)
 
void cancelTimeout ()
 
bool isScheduled () const
 
void attachTimeoutManager (TimeoutManager *timeoutManager, InternalEnum internal=InternalEnum::NORMAL)
 
void attachEventBase (EventBase *eventBase, InternalEnum internal=InternalEnum::NORMAL)
 
void detachTimeoutManager ()
 
void detachEventBase ()
 
const TimeoutManagergetTimeoutManager ()
 
struct event * getEvent ()
 

Static Public Member Functions

static void setTimeoutClock (MockTimeoutClock &clock)
 
- Static Public Member Functions inherited from folly::AsyncTimeout
template<typename TCallback >
static std::unique_ptr< AsyncTimeoutmake (TimeoutManager &manager, TCallback &&callback)
 
template<typename TCallback >
static std::unique_ptr< AsyncTimeoutschedule (TimeoutManager::timeout_type timeout, TimeoutManager &manager, TCallback &&callback)
 

Public Attributes

TimePoint timestamp
 
std::deque< TimePointtimestamps
 
std::deque< TimePointcanceledTimestamps
 
std::function< void()> fn
 
std::deque< milliseconds > timestamps
 

Private Attributes

std::deque< AsyncTimeoutSet * > nextSets_
 

Static Private Attributes

static MockTimeoutClockclock_ = nullptr
 

Additional Inherited Members

- Public Types inherited from folly::AsyncTimeout
typedef TimeoutManager::InternalEnum InternalEnum
 

Detailed Description

Definition at line 893 of file EventBaseTest.cpp.

Constructor & Destructor Documentation

TestTimeout::TestTimeout ( EventBase eventBase)
inlineexplicit

Definition at line 895 of file EventBaseTest.cpp.

896  : AsyncTimeout(eventBase), timestamp(false) {}
TimePoint timestamp
TestTimeout::TestTimeout ( )
inline

Definition at line 33 of file HHWheelTimerSlowTests.cpp.

33 {}
TestTimeout::TestTimeout ( HHWheelTimer t,
milliseconds  timeout 
)
inline

Definition at line 34 of file HHWheelTimerSlowTests.cpp.

References folly::HHWheelTimer::scheduleTimeout().

34  {
35  t->scheduleTimeout(this, timeout);
36  }
void scheduleTimeout(Callback *callback, std::chrono::milliseconds timeout)
TestTimeout::TestTimeout ( )
inline

Definition at line 30 of file HHWheelTimerTest.cpp.

30 {}
TestTimeout::TestTimeout ( HHWheelTimer t,
milliseconds  timeout 
)
inline

Definition at line 31 of file HHWheelTimerTest.cpp.

References folly::HHWheelTimer::scheduleTimeout().

31  {
32  t->scheduleTimeout(this, timeout);
33  }
void scheduleTimeout(Callback *callback, std::chrono::milliseconds timeout)
template<typename... Args>
TestTimeout::TestTimeout ( Args &&...  args)
inlineexplicit

Definition at line 40 of file AsyncTimeoutSetTest.cpp.

40  {
41  addTimeout(std::forward<Args>(args)...);
42  _scheduleNext();
43  }
void addTimeout(AsyncTimeoutSet *set)
TestTimeout::TestTimeout ( )
inline

Definition at line 44 of file AsyncTimeoutSetTest.cpp.

44 {}

Member Function Documentation

void TestTimeout::_scheduleNext ( )
inline

Definition at line 64 of file AsyncTimeoutSetTest.cpp.

References proxygen::AsyncTimeoutSet::front(), and proxygen::AsyncTimeoutSet::scheduleTimeout().

64  {
65  if (nextSets_.empty()) {
66  return;
67  }
68  AsyncTimeoutSet* nextSet = nextSets_.front();
69  nextSets_.pop_front();
70  nextSet->scheduleTimeout(this);
71  }
void scheduleTimeout(Callback *callback)
std::deque< AsyncTimeoutSet * > nextSets_
void TestTimeout::addTimeout ( AsyncTimeoutSet set)
inline

Definition at line 46 of file AsyncTimeoutSetTest.cpp.

46  {
47  nextSets_.push_back(set);
48  }
std::deque< AsyncTimeoutSet * > nextSets_
template<typename... Args>
void TestTimeout::addTimeout ( AsyncTimeoutSet set,
Args &&...  args 
)
inline

Definition at line 51 of file AsyncTimeoutSetTest.cpp.

51  {
52  addTimeout(set);
53  addTimeout(std::forward<Args>(args)...);
54  }
void addTimeout(AsyncTimeoutSet *set)
void TestTimeout::callbackCanceled ( )
inlineoverridenoexcept

Definition at line 42 of file HHWheelTimerTest.cpp.

42  {
43  canceledTimestamps.emplace_back();
44  if (fn) {
45  fn();
46  }
47  }
std::deque< TimePoint > canceledTimestamps
std::function< void()> fn
void TestTimeout::callbackCanceled ( )
inlineoverridenoexcept

Definition at line 45 of file HHWheelTimerSlowTests.cpp.

45  {
46  canceledTimestamps.emplace_back();
47  if (fn) {
48  fn();
49  }
50  }
std::deque< TimePoint > canceledTimestamps
std::function< void()> fn
static void TestTimeout::setTimeoutClock ( MockTimeoutClock clock)
inlinestatic

Definition at line 76 of file AsyncTimeoutSetTest.cpp.

Referenced by TimeoutTest::SetUp().

76  {
77  clock_ = &clock;
78  }
static MockTimeoutClock * clock_
void TestTimeout::timeoutExpired ( )
inlineoverridevirtualnoexcept

timeoutExpired() is invoked when the timeout period has expired.

Implements folly::AsyncTimeout.

Definition at line 35 of file HHWheelTimerTest.cpp.

35  {
36  timestamps.emplace_back();
37  if (fn) {
38  fn();
39  }
40  }
std::deque< TimePoint > timestamps
std::function< void()> fn
void TestTimeout::timeoutExpired ( )
inlineoverridevirtualnoexcept

timeoutExpired() is invoked when the timeout period has expired.

Implements folly::AsyncTimeout.

Definition at line 38 of file HHWheelTimerSlowTests.cpp.

38  {
39  timestamps.emplace_back();
40  if (fn) {
41  fn();
42  }
43  }
std::deque< TimePoint > timestamps
std::function< void()> fn
void TestTimeout::timeoutExpired ( )
inlineoverridevirtualnoexcept

timeoutExpired() is invoked when the timeout period has expired.

Implements folly::AsyncTimeout.

Definition at line 56 of file AsyncTimeoutSetTest.cpp.

56  {
57  timestamps.emplace_back(clock_->millisecondsSinceEpoch());
58  _scheduleNext();
59  if (fn) {
60  fn();
61  }
62  }
static MockTimeoutClock * clock_
virtual std::chrono::milliseconds millisecondsSinceEpoch()=0
std::deque< TimePoint > timestamps
std::function< void()> fn
void TestTimeout::timeoutExpired ( )
inlineoverridevirtualnoexcept

timeoutExpired() is invoked when the timeout period has expired.

Implements folly::AsyncTimeout.

Definition at line 898 of file EventBaseTest.cpp.

898  {
899  timestamp.reset();
900  }
TimePoint timestamp

Member Data Documentation

std::deque< TimePoint > TestTimeout::canceledTimestamps

Definition at line 53 of file HHWheelTimerSlowTests.cpp.

Referenced by TEST_F().

MockTimeoutClock * TestTimeout::clock_ = nullptr
staticprivate

Definition at line 81 of file AsyncTimeoutSetTest.cpp.

std::function< void()> TestTimeout::fn

Definition at line 54 of file HHWheelTimerSlowTests.cpp.

Referenced by TEST_F().

std::deque<AsyncTimeoutSet*> TestTimeout::nextSets_
private

Definition at line 82 of file AsyncTimeoutSetTest.cpp.

TimePoint TestTimeout::timestamp

Definition at line 902 of file EventBaseTest.cpp.

Referenced by TEST().

std::deque< TimePoint > TestTimeout::timestamps

Definition at line 52 of file HHWheelTimerSlowTests.cpp.

Referenced by TEST_F().

std::deque<milliseconds> TestTimeout::timestamps

Definition at line 73 of file AsyncTimeoutSetTest.cpp.


The documentation for this class was generated from the following files: