proxygen
Utilities.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 #include <fizz/client/PskCache.h>
11 
12 namespace fizz {
13 namespace client {
14 namespace test {
15 
17  std::string pskName,
18  std::chrono::system_clock::time_point issueTime) {
19  CachedPsk psk;
20  psk.psk = std::move(pskName);
21  psk.secret = "resumptionsecret";
26  psk.maxEarlyDataSize = 0;
27  psk.ticketAgeAdd = 0x11111111;
28  psk.ticketIssueTime = issueTime;
29  psk.ticketExpirationTime = issueTime + std::chrono::seconds(10);
30  psk.alpn = "h2";
31  return psk;
32 }
33 
34 void pskEq(const CachedPsk& psk1, const CachedPsk& psk2) {
35  EXPECT_EQ(psk1.psk, psk2.psk);
36  EXPECT_EQ(psk1.secret, psk2.secret);
37  EXPECT_EQ(psk1.type, psk2.type);
38  EXPECT_EQ(psk1.version, psk2.version);
39  EXPECT_EQ(psk1.cipher, psk2.cipher);
40  EXPECT_EQ(psk1.group, psk2.group);
45  EXPECT_EQ(psk1.alpn, psk2.alpn);
46 }
47 } // namespace test
48 } // namespace client
49 } // namespace fizz
std::chrono::system_clock::time_point ticketIssueTime
Definition: PskCache.h:35
folly::Optional< std::string > alpn
Definition: PskCache.h:32
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
ProtocolVersion version
Definition: PskCache.h:25
CachedPsk getTestPsk(std::string pskName, std::chrono::system_clock::time_point issueTime)
Definition: Utilities.h:16
folly::Optional< NamedGroup > group
Definition: PskCache.h:27
std::string secret
Definition: PskCache.h:22
Definition: Actions.h:16
void pskEq(const CachedPsk &psk1, const CachedPsk &psk2)
Definition: Utilities.h:34
const char * string
Definition: Conv.cpp:212
CipherSuite cipher
Definition: PskCache.h:26
uint32_t maxEarlyDataSize
Definition: PskCache.h:31
std::chrono::system_clock::time_point ticketExpirationTime
Definition: PskCache.h:36