20 #define GMOCK_NOEXCEPT_METHOD0(m, F) GMOCK_METHOD0_(, noexcept, , m, F) 21 #define GMOCK_NOEXCEPT_METHOD1(m, F) GMOCK_METHOD1_(, noexcept, , m, F) 47 using HeaderMap = std::map<std::string, std::string>;
50 bool keepalive =
true,
57 folly::to<std::string>(content_length));
58 for (
auto& nv : headers) {
74 while (content_length > 0) {
77 memset(buf,
'a', toSend);
79 content_length -= toSend;
90 bool keepalive =
true,
92 bool hasTrailers =
false) {
97 trailers.
add(
"X-Trailer1",
"Foo");
119 while (content_length > 0) {
122 memset(buf,
'a', toSend);
126 content_length -= toSend;
130 trailers.
add(
"X-Trailer1",
"Foo");
139 std::shared_ptr<HTTPMessage>
msg_;
159 onHeadersComplete(std::shared_ptr<HTTPMessage>(msg.release()));
163 void(std::shared_ptr<HTTPMessage> msg));
166 onBody(std::shared_ptr<folly::IOBuf>(chain.release()));
175 onTrailers(std::shared_ptr<HTTPHeaders>(trailers.release()));
179 void(std::shared_ptr<HTTPHeaders> trailers));
200 .RetiresOnSaturation();
205 .WillOnce(testing::SaveArg<0>(pTxn ? pTxn : &
txn_));
208 void expectHeaders(std::function<
void()> callback = std::function<
void()>()) {
212 .RetiresOnSaturation();
221 .RetiresOnSaturation();
225 std::function<
void(std::shared_ptr<HTTPHeaders> trailers)> cb) {
228 .RetiresOnSaturation();
232 std::function<
void()> callback = std::function<
void()>()) {
241 void expectBody(std::function<
void()> callback = std::function<
void()>()) {
250 void expectBody(std::function<
void(std::shared_ptr<folly::IOBuf>)> callback) {
255 std::function<
void()> callback = std::function<
void()>()) {
264 void expectEOM(std::function<
void()> callback = std::function<
void()>()) {
273 std::function<
void()> callback = std::function<
void()>()) {
282 std::function<
void()> callback = std::function<
void()>()) {
311 std::function<
void()> callback = std::function<
void()>()) {
353 folly::to<std::string>(content_length));
394 std::string bodystr((
const char*)arg0->data(), arg0->length());
399 EXPECT_EQ(arg1->computeChainDataLength(), expectedLen);
void recordTTLBATimeout() noexceptoverride
std::shared_ptr< HTTPMessage > msg_
void setWantsKeepalive(bool wantsKeepaliveVal)
void sendReplyCode(uint32_t code)
uint32_t streamDependency
virtual void sendTrailers(const HTTPHeaders &trailers)
void setLastByteFlushedTrackingEnabled(bool enabled)
void onHeadersComplete(std::unique_ptr< HTTPMessage > msg) noexceptoverride
MockHTTPPushHandler(HTTPTransaction &txn, HTTPMessage *msg, const folly::SocketAddress &)
#define EXPECT_EQ(val1, val2)
void recordTTLBAEomPassed() noexceptoverride
void sendBodyWithLastByteTracking(uint32_t content_length)
void sendChunkedReplyWithBody(uint32_t code, uint32_t content_length, uint32_t chunkSize, bool hasTrailers, bool sendEOM=true)
#define GMOCK_NOEXCEPT_METHOD0(m, F)
void expectEgressPaused(std::function< void()> callback=std::function< void()>())
void sendReplyWithBody(uint32_t code, uint32_t content_length, bool keepalive=true, bool sendEOM=true, bool hasTrailers=false)
void recordTTLBATracked() noexceptoverride
void recordTTLBAExceedLimit() noexceptoverride
void expectError(std::function< void(const HTTPException &ex)> callback=std::function< void(const HTTPException &ex)>())
requires E e noexcept(noexcept(s.error(std::move(e))))
void recordTTLBANotFound() noexceptoverride
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
#define GMOCK_NOEXCEPT_METHOD1(m, F)
std::map< std::string, std::string > HeaderMap
void expectChunkComplete(std::function< void()> callback=std::function< void()>())
#define MOCK_METHOD3(m,...)
void setIsChunked(bool chunked)
ACTION_P(ExpectString, expected)
void setHTTP2Priority(HTTPPriority h2Pri)
void recordTransactionsServed(uint64_t) noexceptoverride
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
void expectTransaction(HTTPTransaction **pTxn=nullptr)
void sendRequest(HTTPMessage req)
void sendHeaders(uint32_t code, uint32_t content_length, bool keepalive=true, HeaderMap headers=HeaderMap())
void expectEOM(std::function< void()> callback=std::function< void()>())
void expectEgressResumed(std::function< void()> callback=std::function< void()>())
void recordTransactionOpened() noexceptoverride
virtual void sendBody(std::unique_ptr< folly::IOBuf > body)
MockHTTPHandler(HTTPTransaction &txn, HTTPMessage *msg, const folly::SocketAddress &)
virtual void sendHeaders(const HTTPMessage &headers)
HTTPHeaders & getHeaders()
void expectDetachTransaction(std::function< void()> callback=std::function< void()>())
void sendBody(uint32_t content_length)
void expectTransaction(std::function< void(HTTPTransaction *txn)> callback)
void expectHeaders(std::function< void()> callback=std::function< void()>())
void expectTrailers(std::function< void(std::shared_ptr< HTTPHeaders > trailers)> cb)
void recordSessionStalled() noexceptoverride
std::vector< HTTPSetting > SettingsList
void recordTransactionClosed() noexceptoverride
void expectGoaway(std::function< void(ErrorCode)> callback=std::function< void(ErrorCode)>())
void expectChunkHeader(std::function< void()> callback=std::function< void()>())
#define MOCK_METHOD1(m,...)
void sendPushHeaders(const std::string &path, const std::string &host, uint32_t content_length, http2::PriorityUpdate pri)
HTTPMessage getGetRequest(const std::string &url)
void recordTransactionStalled() noexceptoverride
void expectBody(std::function< void(std::shared_ptr< folly::IOBuf >)> callback)
#define MOCK_CONST_METHOD0(m,...)
virtual void sendChunkTerminator()
void setHTTPVersion(uint8_t major, uint8_t minor)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
void recordTTLBAIOBSplitByEom() noexceptoverride
void recordTTLBAReceived() noexceptoverride
void onTrailers(std::unique_ptr< HTTPHeaders > trailers) noexceptoverride
HTTPHandlerBase(HTTPTransaction *txn, HTTPMessage *msg)
void onBody(std::unique_ptr< folly::IOBuf > chain) noexceptoverride
void recordSessionReused() noexceptoverride
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
#define MOCK_METHOD2(m,...)
void expectBody(std::function< void()> callback=std::function< void()>())
virtual void sendChunkHeader(size_t length)
void expectHeaders(std::function< void(std::shared_ptr< HTTPMessage >)> cb)
#define MOCK_METHOD0(m,...)
void setStatusCode(uint16_t status)