27 using std::unique_ptr;
40 bool delayResponse=
false) {
48 .WillOnce(
Invoke([=](std::shared_ptr<HTTPMessage> ) {
60 .WillRepeatedly(
Invoke([=](
Unused, std::shared_ptr<folly::IOBuf> body,
62 auto cur = body->computeChainDataLength();
71 CHECK_EQ(sent_, size);
78 .WillRepeatedly(
Invoke([=](std::shared_ptr<folly::IOBuf> body) {
79 received_ += body->computeChainDataLength();
83 CHECK_EQ(received_, size);
101 std::chrono::milliseconds(500))};
118 txnEgressQueue_, transactionTimeouts_.get(),
119 std::chrono::milliseconds(500));
120 setupRequestResponseFlow(&txn, 100);
133 txnEgressQueue_, transactionTimeouts_.get(),
134 std::chrono::milliseconds(500),
140 setupRequestResponseFlow(&txn, reqBodySize);
154 txnEgressQueue_, transactionTimeouts_.get(),
155 std::chrono::milliseconds(500),
161 setupRequestResponseFlow(&txn, reqBodySize,
true);
168 txn.onIngressBody(
makeBuf(reqBodySize), 0);
171 txn.sendHeaders(*response.get());
172 txn.sendBody(
makeBuf(reqBodySize));
186 txnEgressQueue_, transactionTimeouts_.get(),
187 std::chrono::milliseconds(500),
193 setupRequestResponseFlow(&txn, reqSize);
203 txn.setReceiveWindow(perStreamWindow);
218 txnEgressQueue_, transactionTimeouts_.get(),
219 std::chrono::milliseconds(500),
224 setupRequestResponseFlow(&txn, 500);
232 txn.setReceiveWindow(perStreamWindow);
246 txnEgressQueue_, transactionTimeouts_.get(),
247 std::chrono::milliseconds(500));
250 err.setHttpStatusCode(400);
266 txn.setHandler(&handler_);
271 txn.onIngressBody(
makeBuf(10), 0);
277 unique_ptr<StrictMock<MockHTTPHandler>>
handler(
283 txnEgressQueue_, transactionTimeouts_.get(),
284 std::chrono::milliseconds(500));
290 .WillOnce(
Invoke([&](std::shared_ptr<HTTPMessage> ) {
292 txn.sendHeaders(*response.get());
302 txn.setHandler(
nullptr);
309 txn.setHandler(handler.get());
316 .WillRepeatedly(
Return());
318 .WillRepeatedly(
Return());
323 txnEgressQueue_, transactionTimeouts_.get(),
324 std::chrono::milliseconds(500),
325 nullptr,
true, 10, 10);
331 .WillOnce(
Invoke([&](std::shared_ptr<HTTPMessage> ) {
333 txn.sendHeaders(*response.get());
348 txn.setHandler(&handler_);
354 EXPECT_EQ(txn.onWriteReady(20, 1),
false);
359 txn.onIngressWindowUpdate(20);
372 unique_ptr<StrictMock<MockHTTPHandler>>
handler(
378 txnEgressQueue_, transactionTimeouts_.get(),
379 std::chrono::milliseconds(500));
385 .WillOnce(
Invoke([&](std::shared_ptr<HTTPMessage> ) {
387 txn.sendHeaders(*response.get());
399 txn.setHandler(handler.get());
411 txnEgressQueue_, transactionTimeouts_.get(),
412 std::chrono::milliseconds(500),
424 txn.setHandler(&handler);
426 txn.onIngressBody(
makeBuf(401), 0);
virtual void setHandler(Handler *handler)
MockHTTPTransactionTransport transport_
bool onWriteReady(uint32_t maxEgress, double ratio)
std::unique_ptr< folly::IOBuf > makeBuf(uint32_t size)
#define ASSERT_EQ(val1, val2)
uint16_t getStatusCode() const
#define EXPECT_EQ(val1, val2)
void onIngressBody(std::unique_ptr< folly::IOBuf > chain, uint16_t padding)
static int DEFAULT_TICK_INTERVAL
std::unique_ptr< HTTPMessage > makePostRequest(uint32_t contentLength)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
DownstreamTransactionTest()
void handler(int, siginfo_t *, void *)
constexpr auto size(C const &c) -> decltype(c.size())
static UniquePtr newTimer(Args &&...args)
Direction getDirection() const
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
virtual void sendBody(std::unique_ptr< folly::IOBuf > body)
virtual void sendHeaders(const HTTPMessage &headers)
std::unique_ptr< HHWheelTimer, Destructor > UniquePtr
std::unique_ptr< HTTPMessage > makeResponse(uint16_t statusCode)
void setupRequestResponseFlow(HTTPTransaction *txn, uint32_t size, bool delayResponse=false)
internal::DoDefaultAction DoDefault()
StrictMock< MockHTTPHandler > handler_
HTTP2PriorityQueue txnEgressQueue_
AsyncFizzClient::UniquePtr transport_
std::unique_ptr< HTTPMessage > makeGetRequest()
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST_F(HeaderTableTests, IndexTranslation)
const char * what(void) const noexceptoverride
folly::EventBase eventBase_
internal::ReturnAction< R > Return(R value)
const uint32_t kInitialWindow