proxygen
fizz::server::test::AeadTicketCipherTest Class Reference
Inheritance diagram for fizz::server::test::AeadTicketCipherTest:
testing::Test

Public Member Functions

 ~AeadTicketCipherTest () override=default
 
void SetUp () override
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Protected Member Functions

void setTicketSecrets (std::string pskContext="")
 
void expectDecode ()
 
void checkUnsetEncrypt ()
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 

Protected Attributes

TestAeadTicketCipher cipher_
 
MockTicketCodecInstance codec_
 

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)
 

Detailed Description

Definition at line 79 of file AeadTicketCipherTest.cpp.

Constructor & Destructor Documentation

fizz::server::test::AeadTicketCipherTest::~AeadTicketCipherTest ( )
overridedefault

Member Function Documentation

void fizz::server::test::AeadTicketCipherTest::checkUnsetEncrypt ( )
inlineprotected

Definition at line 112 of file AeadTicketCipherTest.cpp.

References fizz::server::AeadTicketCipher< AeadType, CodecType, HkdfType >::encrypt(), EXPECT_FALSE, and folly::gen::move.

112  {
113  ResumptionState state;
114  EXPECT_FALSE(cipher_.encrypt(std::move(state)).get().hasValue());
115  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::Future< folly::Optional< std::pair< Buf, std::chrono::seconds > > > encrypt(ResumptionState resState) const override
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
state
Definition: http_parser.c:272
void fizz::server::test::AeadTicketCipherTest::expectDecode ( )
inlineprotected

Definition at line 102 of file AeadTicketCipherTest.cpp.

References testing::_, folly::IOBuf::copyBuffer(), EXPECT_CALL, EXPECT_TRUE, and testing::Invoke().

102  {
103  EXPECT_CALL(codec_, _decode(_, _))
104  .WillOnce(
105  Invoke([](Buf& encoded, const FizzServerContext* /*context*/) {
106  EXPECT_TRUE(
107  IOBufEqualTo()(encoded, IOBuf::copyBuffer("encodedticket")));
108  return ResumptionState();
109  }));
110  }
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
std::unique_ptr< folly::IOBuf > Buf
Definition: Types.h:22
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
Definition: IOBuf.h:1587
void fizz::server::test::AeadTicketCipherTest::setTicketSecrets ( std::string  pskContext = "")
inlineprotected

Definition at line 90 of file AeadTicketCipherTest.cpp.

References EXPECT_TRUE, folly::gen::move, fizz::server::AeadTicketCipher< AeadType, CodecType, HkdfType >::setTicketSecrets(), ticketSecret1, ticketSecret2, and fizz::test::toIOBuf().

90  {
91  if (!pskContext.empty()) {
92  cipher_ = TestAeadTicketCipher(pskContext);
93  } else {
95  }
96  auto s1 = toIOBuf(ticketSecret1);
97  auto s2 = toIOBuf(ticketSecret2);
98  std::vector<ByteRange> ticketSecrets{{s1->coalesce(), s2->coalesce()}};
100  }
std::unique_ptr< folly::IOBuf > toIOBuf(std::string hexData)
static constexpr StringPiece ticketSecret1
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
bool setTicketSecrets(const std::vector< folly::ByteRange > &ticketSecrets)
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
AeadTicketCipher< OpenSSLEVPCipher< AESGCM128 >, MockTicketCodec, HkdfImpl< Sha256 >> TestAeadTicketCipher
static constexpr StringPiece ticketSecret2
void fizz::server::test::AeadTicketCipherTest::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 82 of file AeadTicketCipherTest.cpp.

References codec_.

82  {
84  }
static MockTicketCodecInstance * instance

Member Data Documentation

TestAeadTicketCipher fizz::server::test::AeadTicketCipherTest::cipher_
protected

Definition at line 87 of file AeadTicketCipherTest.cpp.

MockTicketCodecInstance fizz::server::test::AeadTicketCipherTest::codec_
protected

Definition at line 88 of file AeadTicketCipherTest.cpp.


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