proxygen
FlowControlFilterTest< initSize > Class Template Reference
Inheritance diagram for FlowControlFilterTest< initSize >:
FilterTest testing::Test

Public Member Functions

void SetUp () override
 
- Public Member Functions inherited from FilterTest
 FilterTest ()
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Public Attributes

StrictMock< MockFlowControlCallbackflowCallback_
 
FlowControlFilterfilter_
 
int recvWindow_ {initSize}
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
- Protected Attributes inherited from FilterTest
MockHTTPCodeccodec_
 
HTTPCodec::CallbackcallbackStart_
 
HTTPCodecFilterChain chain_
 
MockHTTPCodecCallback callback_
 
folly::IOBufQueue writeBuf_ {folly::IOBufQueue::cacheChainLength()}
 

Detailed Description

template<int initSize>
class FlowControlFilterTest< initSize >

Definition at line 60 of file FilterTests.cpp.

Member Function Documentation

template<int initSize>
void FlowControlFilterTest< initSize >::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 62 of file FilterTests.cpp.

References testing::_, folly::IOBufQueue::append(), codec_, EXPECT_CALL, testing::Invoke(), testing::InvokeWithoutArgs(), proxygen::makeBuf(), testing::Return(), and fizz::detail::writeBuf().

62  {
63  EXPECT_CALL(*codec_, getDefaultWindowSize())
64  .WillRepeatedly(Return(kInitialCapacity));
65 
66  if (initSize > kInitialCapacity) {
67  // If the initial size is bigger than the default, a window update
68  // will immediately be generated
69  EXPECT_CALL(*codec_, generateWindowUpdate(_, 0, initSize -
70  kInitialCapacity))
71  .WillOnce(InvokeWithoutArgs([this] () {
73  return 10;
74  }));
75  }
76  EXPECT_CALL(*codec_, generateBody(_, _, _, _, _))
77  .WillRepeatedly(Invoke([](folly::IOBufQueue& writeBuf,
78  HTTPCodec::StreamID /*stream*/,
79  std::shared_ptr<folly::IOBuf> chain,
80  folly::Optional<uint8_t> /*padding*/,
81  bool /*eom*/) {
82  auto len = chain->computeChainDataLength() + 4;
83  writeBuf.append(makeBuf(len));
84  return len;
85  }));
86  EXPECT_CALL(*codec_, isReusable()).WillRepeatedly(Return(true));
87 
88  // Construct flow control filter with capacity of 0, which will be
89  // overridden to the codec default, which is the minimum
91  initSize);
92  chain_.addFilters(std::unique_ptr<FlowControlFilter>(filter_));
93  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
FlowControlFilter * filter_
Definition: FilterTests.cpp:95
std::enable_if< std::is_constructible< C >::value >::type addFilters()
Definition: FilterChain.h:301
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
std::unique_ptr< folly::IOBuf > makeBuf(uint32_t size)
Definition: ZlibTests.cpp:26
void writeBuf(const Buf &buf, folly::io::Appender &out)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
folly::IOBufQueue writeBuf_
Definition: FilterTests.cpp:49
MockHTTPCodec * codec_
Definition: FilterTests.cpp:45
#define EXPECT_CALL(obj, call)
uint64_t StreamID
Definition: HTTPCodec.h:49
const internal::AnythingMatcher _
HTTPCodecFilterChain chain_
Definition: FilterTests.cpp:47
StrictMock< MockFlowControlCallback > flowCallback_
Definition: FilterTests.cpp:94
internal::ReturnAction< R > Return(R value)

Member Data Documentation

template<int initSize>
FlowControlFilter* FlowControlFilterTest< initSize >::filter_

Definition at line 95 of file FilterTests.cpp.

template<int initSize>
StrictMock<MockFlowControlCallback> FlowControlFilterTest< initSize >::flowCallback_

Definition at line 94 of file FilterTests.cpp.

template<int initSize>
int FlowControlFilterTest< initSize >::recvWindow_ {initSize}

Definition at line 96 of file FilterTests.cpp.


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