9 #include <gmock/gmock.h> 10 #include <gtest/gtest.h> 18 using namespace folly;
22 "03041301000673656372657400056964656e74004444444400000000000000190268320000"};
24 "03041301000673656372657400056964656e7400444444440000000000000019026832000b68656c6c6f20776f726c64"};
26 "03041301000673656372657400056964656e7400444444440000000000000019026832"};
28 "03041301000673656372657400056964656e7400444444440000000000000019000000"};
30 "03041301000673656372657400056964656e740103653082036130820249a003020102020900c3420836ac1ca26f300d06092a864886f70d01010b0500304b310b3009060355040613025553310b300906035504080c024e593111300f06035504070c084e657720596f726b310d300b060355040b0c0446697a7a310d300b06035504030c0446697a7a301e170d3136313232393036323431385a170d3431303832303036323431385a304b310b3009060355040613025553310b300906035504080c024e593111300f06035504070c084e657720596f726b310d300b060355040b0c0446697a7a310d300b06035504030c0446697a7a30820122300d06092a864886f70d01010105000382010f003082010a0282010100c564999066687e557e86734a655b8252bd1e39e758b45204535ea60113cfdca3ea1c5adc117b9d039ff8ea1a2881f49bd9662a11a09e96d6371a23c6f963dd8610c48b98788489af2fe83f89353b2cb988866931e212b3018c74d76d35d87c72ee9bc4249cba4bbc047098f403136c585a3c4b2b087cee51c39ec24c7a25c7071bb82b1faba09c6b73c4d2073d51767629a4c936ea61f2058f0dd8a8f00bb9627629bc8632d105ede9e505007f21b8d4413942be5c79e0fbfcc0217400b462445bfaf1fef2835169b49f364a9485173c874248c0933baaa3f9416fca977448de0f5d6ffa0d425e1a2ddb5c5aa5f5717ccaccba66085e1cab2f80f0e54a438ee50203010001a348304630090603551d1304023000300b0603551d0f0404030205e0302c0603551d1104253023820a2a2e66697a7a2e636f6d820866697a7a2e636f6d820b6578616d706c652e6e6574300d06092a864886f70d01010b050003820101008a48bf0c71489acb196f08af3e0fa4a2e878a7ad2c25b71d856bacc17c9c62cac25cde58b6b406940deb7f03b832ceb1a1995f43ac86c3ac3c273d156b9bf1576ee69035cee0cb4b4dda2f61780c1332bcabc39aa6b4f89b23f92b88934e78a05d50e23bf1f551342419b1d457c7679520f9ff032d662f2cc37a1bd3fa618ce810d9f9f3da1afff2476160e82629add8807cd11d64e3b808bc675e5b80a794d1f58d83b5fe6af5c951cdae976439a6f622d744c9c753c3cce2fd038646115ebe3711fa9e9cf8d2abdbf3928aff7e2dfbdb68596f771924286af79abb1bd848330752e24874e5940fb24bcf10cf1712461cd279283f6ef2fec6c593c5c1a0d70d4444444400000000000000190268320000"};
32 "03041301000673656372657400056964656e74020008636c69656e7469644444444400000000000000190268320000"};
39 std::shared_ptr<SelfCert> cert,
40 std::shared_ptr<PeerCert> peerCert) {
48 rs.
ticketIssueTime = std::chrono::time_point<std::chrono::system_clock>(
49 std::chrono::seconds(25));
54 TEST(TicketCodecTest, TestEncode) {
55 auto cert = std::make_shared<MockSelfCert>();
64 TEST(TicketCodecTest, TestEncodeWithAppToken) {
65 auto cert = std::make_shared<MockSelfCert>();
74 TEST(TicketCodecTest, TestEncodeNoAlpn) {
75 auto cert = std::make_shared<MockSelfCert>();
84 TEST(TicketCodecTest, TestEncodeClientAuthX509) {
85 auto cert = std::make_shared<MockSelfCert>();
86 auto peerCert = std::make_shared<MockPeerCert>();
97 TEST(TicketCodecTest, TestEncodeClientAuthIdentityOnly) {
98 auto cert = std::make_shared<MockSelfCert>();
99 auto peerCert = std::make_shared<MockPeerCert>();
109 TEST(TicketCodecTest, TestEncodeNoX509) {
110 auto cert = std::make_shared<MockSelfCert>();
111 auto peerCert = std::make_shared<MockPeerCert>();
120 EXPECT_EQ(drs.clientCert->getIdentity(),
"clientid");
121 EXPECT_EQ(drs.clientCert->getX509(),
nullptr);
124 TEST(TicketCodecTest, TestDecodeDifferentStorage) {
125 auto cert = std::make_shared<MockSelfCert>();
126 auto peerCert = std::make_shared<MockPeerCert>();
136 EXPECT_EQ(drs.clientCert->getIdentity(),
"Fizz");
137 EXPECT_NE(drs.clientCert->getX509(),
nullptr);
147 EXPECT_EQ(drsX509.clientCert->getIdentity(),
"FizzIdOnly");
148 EXPECT_EQ(drsX509.clientCert->getX509(),
nullptr);
151 TEST(TicketCodecTest, TestDecode) {
160 std::chrono::time_point<std::chrono::system_clock>(
161 std::chrono::seconds(25)));
164 EXPECT_EQ(rs.clientCert->getIdentity(),
"Fizz");
167 TEST(TicketCodecTest, TestDecodeNoAlpn) {
173 TEST(TicketCodecTest, TestDecodeTooShort) {
181 TEST(TicketCodecTest, TestDecodeWithAppToken) {
190 std::chrono::time_point<std::chrono::system_clock>(
191 std::chrono::seconds(25)));
196 TEST(TicketCodecTest, TestDecodeWithEmptyAppToken) {
205 std::chrono::time_point<std::chrono::system_clock>(
206 std::chrono::seconds(25)));
210 TEST(TicketCodecTest, TestDecodeWithoutAppToken) {
219 std::chrono::time_point<std::chrono::system_clock>(
220 std::chrono::seconds(25)));
static constexpr StringPiece ticketClientAuthIdentityOnly
unique_ptr< IOBuf > encode(vector< HPACKHeader > &headers, HPACKEncoder &encoder)
#define EXPECT_THROW(statement, expected_exception)
constexpr folly::StringPiece kRSACertificate
#define EXPECT_EQ(val1, val2)
TokenBindingMessage decode(folly::io::Cursor &cursor)
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
folly::Optional< std::string > alpn
std::chrono::system_clock::time_point ticketIssueTime
folly::ssl::X509UniquePtr getCert(folly::StringPiece cert)
static constexpr StringPiece ticketWithoutAppToken
static constexpr StringPiece ticket
std::unique_ptr< folly::IOBuf > toIOBuf(std::string hexData, size_t headroom, size_t tailroom)
TEST(IOBufUtilTest, TrimBytes)
static constexpr StringPiece ticketNoAlpn
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
static ResumptionState getTestResumptionState(std::shared_ptr< SelfCert > cert, std::shared_ptr< PeerCert > peerCert)
static constexpr StringPiece ticketClientAuthX509
#define EXPECT_TRUE(condition)
#define EXPECT_NE(val1, val2)
#define EXPECT_CALL(obj, call)
#define EXPECT_FALSE(condition)
std::shared_ptr< const Cert > serverCert
bool hexlify(const InputString &input, OutputString &output, bool append_output)
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
std::shared_ptr< const Cert > clientCert
static constexpr StringPiece ticketWithAppToken
internal::ReturnAction< R > Return(R value)