25 const uint32_t kInitialCapacity = 12345;
40 .WillRepeatedly(SaveArg<0>(&callbackStart_));
59 template <
int initSize>
64 .WillRepeatedly(
Return(kInitialCapacity));
66 if (initSize > kInitialCapacity) {
79 std::shared_ptr<folly::IOBuf> chain,
82 auto len = chain->computeChainDataLength() + 4;
92 chain_.addFilters(std::unique_ptr<FlowControlFilter>(filter_));
96 int recvWindow_{initSize};
103 return arg->hasCodecStatusCode() &&
105 !arg->hasHttpStatusCode() &&
106 !arg->hasProxygenError();
117 chain_->generateBody(writeBuf_, 1,
123 callbackStart_->onWindowUpdate(0, 1);
126 EXPECT_CALL(flowCallback_, onConnectionSendWindowClosed());
129 EXPECT_CALL(flowCallback_, onConnectionSendWindowOpen());
130 callbackStart_->onWindowUpdate(0, 1);
142 .WillRepeatedly(
Return());
145 callbackStart_->onBody(1,
makeBuf(kInitialCapacity / 2 + 1), 0);
146 filter_->ingressBytesProcessed(writeBuf_, kInitialCapacity / 2);
150 generateWindowUpdate(
_, 0, kInitialCapacity / 2 + 1));
151 filter_->ingressBytesProcessed(writeBuf_, 1);
163 std::shared_ptr<HTTPException> exc,
166 "Failed to reserve receive window, window size=0, " 172 callbackStart_->onBody(1,
makeBuf(recvWindow_), 0);
175 callbackStart_->onBody(1,
makeBuf(1), 0);
184 ASSERT_EQ(filter_->getAvailableSend(), kInitialCapacity);
185 callbackStart_->onWindowUpdate(0, 10);
186 ASSERT_EQ(filter_->getAvailableSend(), kInitialCapacity + 10);
188 EXPECT_CALL(flowCallback_, onConnectionSendWindowClosed());
189 chain_->generateBody(writeBuf_, 1,
190 makeBuf(kInitialCapacity + 10),
192 ASSERT_EQ(filter_->getAvailableSend(), 0);
197 EXPECT_CALL(flowCallback_, onConnectionSendWindowOpen());
204 std::shared_ptr<HTTPException> exc,
207 "Failed to update send window, outstanding=0, " 211 callbackStart_->onWindowUpdate(0, 1);
233 chain_->generateHeader(writeBuf_, 0, msg);
241 std::shared_ptr<HTTPException> exc,
244 ASSERT_EQ(exc->getHttpStatusCode(), 400);
246 strcmp(
"RFC2616: Request Body Not Allowed",
251 msg->setMethod(
"TRACE");
253 callbackStart_->onHeadersComplete(0,
std::move(msg));
#define ASSERT_GT(val1, val2)
std::unique_ptr< folly::IOBuf > makeBuf(uint32_t size)
static const folly::Optional< uint8_t > NoPadding
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
FlowControlFilter * filter_
#define ASSERT_EQ(val1, val2)
#define EXPECT_DEATH_NO_CORE(token, regex)
constexpr detail::Map< Move > move
std::unique_ptr< Codec > codec_
std::unique_ptr< HTTPMessage > makePostRequest(uint32_t contentLength)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
void writeBuf(const Buf &buf, folly::io::Appender &out)
static Options cacheChainLength()
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
MockHTTPCodecCallback callback_
void setMethod(HTTPMethod method)
HTTPCodec::Callback * callbackStart_
HTTPMessage getPostRequest(uint32_t contentLength)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
HTTPCodecFilterChain chain_
TEST_F(HeaderTableTests, IndexTranslation)
MATCHER(IsFlowException,"")
folly::Function< void()> callback_
#define ASSERT_FALSE(condition)
StrictMock< MockFlowControlCallback > flowCallback_
#define ASSERT_TRUE(condition)
internal::ReturnAction< R > Return(R value)
#define MOCK_METHOD0(m,...)