proxygen
MockHTTPUpstreamTest Class Reference
Inheritance diagram for MockHTTPUpstreamTest:
HTTPUpstreamTest< MockHTTPCodecPair > testing::Test MockHTTP2UpstreamTest TestAbortPost< stage >

Public Member Functions

void SetUp () override
 
void TearDown () override
 
std::unique_ptr< StrictMock< MockHTTPHandler > > openTransaction ()
 
- Public Member Functions inherited from HTTPUpstreamTest< MockHTTPCodecPair >
 HTTPUpstreamTest (std::vector< int64_t > flowControl={-1,-1,-1})
 
void resumeWrites ()
 
virtual void onWriteChain (folly::AsyncTransportWrapper::WriteCallback *callback, std::shared_ptr< IOBuf > iob, WriteFlags)
 
void handleWrite (folly::AsyncTransportWrapper::WriteCallback *callback)
 
void SetUp () override
 
void commonSetUp (unique_ptr< HTTPCodec > codec)
 
unique_ptr< typename MockHTTPCodecPair::CodecmakeServerCodec ()
 
void enableExHeader (typename MockHTTPCodecPair::Codec *serverCodec)
 
void parseOutput (HTTPCodec &serverCodec)
 
void readAndLoop (const std::string &input)
 
void readAndLoop (IOBuf *buf)
 
void readAndLoop (const uint8_t *input, size_t length)
 
void testBasicRequest ()
 
void testBasicRequestHttp10 (bool keepalive)
 
void onCreate (const HTTPSessionBase &) override
 
void onDestroy (const HTTPSessionBase &) override
 
void onSettingsOutgoingStreamsFull (const HTTPSessionBase &) override
 
void onSettingsOutgoingStreamsNotFull (const HTTPSessionBase &) override
 
void TearDown () override
 
std::unique_ptr< StrictMock< MockHTTPHandler > > openTransaction (bool expectStartPaused=false)
 
std::unique_ptr< NiceMock< MockHTTPHandler > > openNiceTransaction (bool expectStartPaused=false)
 
void testSimpleUpgrade (const std::string &upgradeReqHeader, const std::string &upgradeRespHeader, CodecProtocol respCodecVersion)
 
MockByteEventTrackersetMockByteEventTracker ()
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Public Attributes

MockHTTPCodeccodecPtr_ {nullptr}
 
HTTPCodec::CallbackcodecCb_ {nullptr}
 
bool reusable_ {true}
 
uint32_t nextOutgoingTxn_ {1}
 

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 ()
 
 Test ()
 
 Test ()
 
- Protected Attributes inherited from HTTPUpstreamTest< MockHTTPCodecPair >
bool sessionCreated_
 
bool sessionDestroyed_
 
bool transactionsFull_
 
bool transportGood_
 
EventBase eventBase_
 
EventBaseeventBasePtr_
 
MockAsyncTransporttransport_
 
folly::AsyncTransportWrapper::ReadCallbackreadCallback_
 
folly::AsyncTransport::ReplaySafetyCallbackreplaySafetyCallback_
 
folly::HHWheelTimer::UniquePtr transactionTimeouts_
 
std::vector< int64_tflowControl_
 
wangle::TransportInfo mockTransportInfo_
 
SocketAddress localAddr_
 
SocketAddress peerAddr_
 
HTTPUpstreamSessionhttpSession_
 
IOBufQueue writes_
 
std::vector< folly::AsyncTransportWrapper::WriteCallback * > cbs_
 
bool failWrites_
 
bool pauseWrites_
 
bool writeInLoop_
 

Detailed Description

Definition at line 1738 of file HTTPUpstreamSessionTest.cpp.

Member Function Documentation

std::unique_ptr<StrictMock<MockHTTPHandler> > MockHTTPUpstreamTest::openTransaction ( )
inline

Definition at line 1783 of file HTTPUpstreamSessionTest.cpp.

References EXPECT_EQ, and handler().

1783  {
1784  // Returns a mock handler with txn_ field set in it
1785  auto handler = std::make_unique<StrictMock<MockHTTPHandler>>();
1786  handler->expectTransaction();
1787  auto txn = httpSession_->newTransaction(handler.get());
1788  EXPECT_EQ(txn, handler->txn_);
1789  return handler;
1790  }
HTTPTransaction * newTransaction(HTTPTransaction::Handler *handler) override
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void handler(int, siginfo_t *, void *)
void MockHTTPUpstreamTest::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Reimplemented in MockHTTP2UpstreamTest.

Definition at line 1740 of file HTTPUpstreamSessionTest.cpp.

References testing::_, folly::IOBufQueue::append(), codec, EXPECT_CALL, EXPECT_LT, testing::Invoke(), max, folly::gen::move, testing::Return(), and fizz::detail::writeBuf().

Referenced by MockHTTP2UpstreamTest::SetUp().

1740  {
1741  auto codec = std::make_unique<NiceMock<MockHTTPCodec>>();
1742  codecPtr_ = codec.get();
1743  EXPECT_CALL(*codec, supportsParallelRequests())
1744  .WillRepeatedly(Return(true));
1745  EXPECT_CALL(*codec, getTransportDirection())
1746  .WillRepeatedly(Return(TransportDirection::UPSTREAM));
1747  EXPECT_CALL(*codec, setCallback(_))
1748  .WillRepeatedly(SaveArg<0>(&codecCb_));
1749  EXPECT_CALL(*codec, isReusable())
1750  .WillRepeatedly(ReturnPointee(&reusable_));
1751  EXPECT_CALL(*codec, isWaitingToDrain())
1752  .WillRepeatedly(ReturnPointee(&reusable_));
1753  EXPECT_CALL(*codec, getDefaultWindowSize())
1754  .WillRepeatedly(Return(65536));
1755  EXPECT_CALL(*codec, getProtocol())
1756  .WillRepeatedly(Return(CodecProtocol::SPDY_3_1));
1757  EXPECT_CALL(*codec, generateGoaway(_, _, _, _))
1758  .WillRepeatedly(Invoke([&] (IOBufQueue& writeBuf,
1759  HTTPCodec::StreamID lastStream,
1760  ErrorCode,
1761  std::shared_ptr<folly::IOBuf>) {
1763  if (reusable_) {
1764  writeBuf.append("GOAWAY", 6);
1765  reusable_ = false;
1766  }
1767  return 6;
1768  }));
1769  EXPECT_CALL(*codec, createStream())
1770  .WillRepeatedly(Invoke([&] {
1771  auto ret = nextOutgoingTxn_;
1772  nextOutgoingTxn_ += 2;
1773  return ret;
1774  }));
1775 
1777  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
LogLevel max
Definition: LogLevel.cpp:31
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
CodecFactory codec
void writeBuf(const Buf &buf, folly::io::Appender &out)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
HTTPCodec::Callback * codecCb_
void commonSetUp(unique_ptr< HTTPCodec > codec)
#define EXPECT_CALL(obj, call)
uint64_t StreamID
Definition: HTTPCodec.h:49
const internal::AnythingMatcher _
#define EXPECT_LT(val1, val2)
Definition: gtest.h:1930
internal::ReturnAction< R > Return(R value)
void MockHTTPUpstreamTest::TearDown ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 1779 of file HTTPUpstreamSessionTest.cpp.

References EXPECT_TRUE.

1779  {
1781  }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859

Member Data Documentation

HTTPCodec::Callback* MockHTTPUpstreamTest::codecCb_ {nullptr}

Definition at line 1793 of file HTTPUpstreamSessionTest.cpp.

MockHTTPCodec* MockHTTPUpstreamTest::codecPtr_ {nullptr}

Definition at line 1792 of file HTTPUpstreamSessionTest.cpp.

uint32_t MockHTTPUpstreamTest::nextOutgoingTxn_ {1}

Definition at line 1795 of file HTTPUpstreamSessionTest.cpp.

bool MockHTTPUpstreamTest::reusable_ {true}

Definition at line 1794 of file HTTPUpstreamSessionTest.cpp.


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