9 #include <gmock/gmock.h> 10 #include <gtest/gtest.h> 23 using namespace folly;
27 template <
typename...
Args>
44 context_ = std::make_shared<FizzServerContext>();
50 std::make_shared<MockServerExtensions>()));
53 ON_CALL(readCallback_, isBufferMovable_()).WillByDefault(
Return(
true));
59 .WillRepeatedly(SaveArg<0>(&socketReadCallback_));
78 expectTransportReadCallback();
82 server_->accept(&handshakeCallback_);
86 std::shared_ptr<const Cert>
clientCert =
nullptr,
87 std::shared_ptr<const Cert>
serverCert =
nullptr) {
91 cipher = negotiatedCipher_,
92 protocolVersion = protocolVersion_]() {
93 auto addExporterToState = [=](
State& newState) {
96 newState.exporterMasterSecret() =
std::move(exporterMaster);
97 newState.cipher() =
cipher;
98 newState.version() = protocolVersion;
112 EXPECT_CALL(handshakeCallback_, _fizzHandshakeSuccess());
113 fullHandshakeSuccess();
131 return eq(*arg, *expected);
197 EXPECT_CALL(handshakeCallback_, _fizzHandshakeError(
_));
203 server_->setReadCB(&readCallback_);
214 server_->setReadCB(&readCallback_);
231 server_->setReadCB(&readCallback_);
236 [&numTimesRun](
State& newState) {
255 EXPECT_CALL(handshakeCallback_, _fizzHandshakeAttemptFallback(
_))
256 .WillOnce(
Invoke([&](std::unique_ptr<IOBuf>& clientHello) {
285 EXPECT_CALL(handshakeCallback_, _fizzHandshakeError(
_));
292 server_->setReadCB(&readCallback_);
308 server_->setReadCB(&readCallback_);
351 EXPECT_CALL(handshakeCallback_, _fizzHandshakeSuccess());
383 EXPECT_CALL(handshakeCallback_, _fizzHandshakeSuccess());
386 fullHandshakeSuccess();
391 server_->setReadCB(&readCallback_);
402 EXPECT_EQ(server_->getSelfCert(),
nullptr);
403 EXPECT_EQ(server_->getPeerCert(),
nullptr);
407 auto clientCert = std::make_shared<MockCert>();
408 auto serverCert = std::make_shared<MockCert>();
410 EXPECT_CALL(handshakeCallback_, _fizzHandshakeSuccess());
413 EXPECT_EQ(server_->getSelfCert(),
nullptr);
415 EXPECT_EQ(server_->getPeerCert(),
nullptr);
MockReadCallback readCallback_
constexpr folly::StringPiece kTokenBindingExporterLabel
void write(const T &in, folly::io::Appender &appender)
GTEST_API_ Cardinality AtLeast(int n)
#define EXPECT_THROW(statement, expected_exception)
Actions actions(Args &&...act)
#define EXPECT_EQ(val1, val2)
MockServerStateMachineInstance * machine_
constexpr detail::Map< Move > move
folly::small_vector< TLSContent, 4 > contents
EventBase * getEventBase()
boost::variant< Actions, folly::Future< Actions >> AsyncActions
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
PolymorphicAction< internal::InvokeWithoutArgsAction< FunctionImpl > > InvokeWithoutArgs(FunctionImpl function_impl)
static MockServerStateMachineInstance * instance
std::unique_ptr< AsyncTransportWrapper, Destructor > UniquePtr
AsyncActions actions(Args &&...act)
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
MATCHER_P(BufMatches, expected,"")
std::shared_ptr< FizzServerContext > context_
AsyncServerSocket::UniquePtr socket_
EncryptionLevel encryptionLevel
void fullHandshakeSuccess(std::shared_ptr< const Cert > clientCert=nullptr, std::shared_ptr< const Cert > serverCert=nullptr)
MockHandshakeCallbackT< MockServerStateMachineInstance > handshakeCallback_
MockWriteCallback writeCallback_
std::shared_ptr< const Cert > serverCert
AsyncTransportWrapper::ReadCallback * socketReadCallback_
MockAsyncTransport * socket_
void expectTransportReadCallback()
#define EXPECT_TRUE(condition)
std::enable_if< std::is_same< Unit, B >::value, void >::type setValue()
#define ON_CALL(obj, call)
std::unique_ptr< AsyncFizzServerT, folly::DelayedDestruction::Destructor > UniquePtr
AsyncFizzServerT< MockServerStateMachineInstance >::UniquePtr server_
std::shared_ptr< const Cert > clientCert
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
#define EXPECT_FALSE(condition)
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
MockServerStateMachineInstance()
TEST_F(AeadCookieCipherTest, TestGetRetry)
internal::ReturnAction< R > Return(R value)
NetworkSocket accept(NetworkSocket s, sockaddr *addr, socklen_t *addrlen)