proxygen
proxygen::DanglingQueueTestBase Class Reference
Inheritance diagram for proxygen::DanglingQueueTestBase:
proxygen::DanglingQueueTest

Public Member Functions

 DanglingQueueTestBase ()
 

Protected Member Functions

void expireNodes ()
 
void tick ()
 

Protected Attributes

std::list< folly::AsyncTimeout * > timeouts_
 
testing::NiceMock< MockTimeoutManagertimeoutManager_
 
folly::UndelayedDestruction< HHWheelTimertimer_ {&timeoutManager_}
 

Detailed Description

Definition at line 716 of file HTTP2PriorityQueueTest.cpp.

Constructor & Destructor Documentation

proxygen::DanglingQueueTestBase::DanglingQueueTestBase ( )
inline

Definition at line 718 of file HTTP2PriorityQueueTest.cpp.

References testing::_, EXPECT_CALL, and testing::Invoke().

718  {
719  // Just under two ticks
721  std::chrono::milliseconds(2 * HHWheelTimer::DEFAULT_TICK_INTERVAL - 1));
722  EXPECT_CALL(timeoutManager_, scheduleTimeout(_, _))
723  .WillRepeatedly(Invoke([this] (folly::AsyncTimeout* timeout,
724  std::chrono::milliseconds) {
725  timeouts_.push_back(timeout);
726  return true;
727  }));
728  }
std::list< folly::AsyncTimeout * > timeouts_
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
static void setNodeLifetime(std::chrono::milliseconds lifetime)
testing::NiceMock< MockTimeoutManager > timeoutManager_

Member Function Documentation

void proxygen::DanglingQueueTestBase::expireNodes ( )
inlineprotected

Definition at line 731 of file HTTP2PriorityQueueTest.cpp.

731  {
732  std::this_thread::sleep_for(
733  std::chrono::milliseconds(2 * HHWheelTimer::DEFAULT_TICK_INTERVAL));
734  // Node lifetime it just under two ticks, so firing twice expires all nodes
735  tick();
736  tick();
737  }
void proxygen::DanglingQueueTestBase::tick ( )
inlineprotected

Definition at line 739 of file HTTP2PriorityQueueTest.cpp.

References folly::f14::swap().

739  {
740  std::list<folly::AsyncTimeout*> timeouts;
741  std::swap(timeouts_, timeouts);
742  for (auto timeout: timeouts) {
743  timeout->timeoutExpired();
744  }
745  }
std::list< folly::AsyncTimeout * > timeouts_
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414

Member Data Documentation

testing::NiceMock<MockTimeoutManager> proxygen::DanglingQueueTestBase::timeoutManager_
protected

Definition at line 748 of file HTTP2PriorityQueueTest.cpp.

std::list<folly::AsyncTimeout*> proxygen::DanglingQueueTestBase::timeouts_
protected

Definition at line 747 of file HTTP2PriorityQueueTest.cpp.

folly::UndelayedDestruction<HHWheelTimer> proxygen::DanglingQueueTestBase::timer_ {&timeoutManager_}
protected

Definition at line 749 of file HTTP2PriorityQueueTest.cpp.


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