proxygen
wangle::SSLSessionPersistentCacheTest Class Reference
Inheritance diagram for wangle::SSLSessionPersistentCacheTest:
testing::Test

Public Member Functions

 SSLSessionPersistentCacheTest ()
 
void SetUp () override
 
void TearDown () override
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Protected Member Functions

void verifyEntryInCache (const std::string &hostname, std::pair< SSL_SESSION *, size_t > session, bool inCache=true)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
 Test ()
 
 Test ()
 

Protected Attributes

std::string filename_
 
MockTimeUtilmockTimeUtil_
 
std::unique_ptr< SSLSessionPersistentCachecache_
 
std::vector< std::pair< SSL_SESSION *, size_t > > sessions_
 
std::pair< SSL_SESSION *, size_t > sessionWithTicket_
 

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 50 of file SSLSessionPersistentCacheTest.cpp.

Constructor & Destructor Documentation

wangle::SSLSessionPersistentCacheTest::SSLSessionPersistentCacheTest ( )
inline

Definition at line 52 of file SSLSessionPersistentCacheTest.cpp.

Member Function Documentation

void wangle::SSLSessionPersistentCacheTest::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 55 of file SSLSessionPersistentCacheTest.cpp.

References wangle::getSessions(), and wangle::getSessionWithTicket().

55  {
56  for (auto& it : getSessions()) {
57  sessions_.emplace_back(it.first, it.second);
58  }
60  sessions_.emplace_back(sessionWithTicket_.first, sessionWithTicket_.second);
61 
62  // Create the cache fresh for each test
65  50, std::chrono::seconds(150)));
66  cache_->setTimeUtil(
67  std::unique_ptr<SSLSessionPersistentCache::TimeUtil>(mockTimeUtil_));
68  }
std::vector< std::pair< SSL_SESSION *, size_t > > sessions_
std::pair< SSL_SESSION *, size_t > sessionWithTicket_
std::vector< std::pair< SSL_SESSION *, size_t > > getSessions()
Definition: TestUtil.cpp:320
std::unique_ptr< SSLSessionPersistentCache > cache_
MockTimeUtilGeneric<> MockTimeUtil
Definition: MockTime.h:42
std::pair< SSL_SESSION *, size_t > getSessionWithTicket()
Definition: TestUtil.cpp:340
void wangle::SSLSessionPersistentCacheTest::TearDown ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 70 of file SSLSessionPersistentCacheTest.cpp.

References EXPECT_TRUE.

70  {
71  for (const auto& it : sessions_) {
72  SSL_SESSION_free(it.first);
73  }
74  sessions_.clear();
75  cache_.reset();
76  EXPECT_TRUE(unlink(filename_.c_str()) != -1);
77  }
std::vector< std::pair< SSL_SESSION *, size_t > > sessions_
std::unique_ptr< SSLSessionPersistentCache > cache_
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
void wangle::SSLSessionPersistentCacheTest::verifyEntryInCache ( const std::string hostname,
std::pair< SSL_SESSION *, size_t >  session,
bool  inCache = true 
)
inlineprotected

Definition at line 80 of file SSLSessionPersistentCacheTest.cpp.

References ASSERT_FALSE, ASSERT_TRUE, wangle::isSameSession(), and s.

82  {
83  auto s = cache_->getSSLSession(hostname);
84  if (inCache) {
85  ASSERT_TRUE(s != nullptr);
88  session,
89  std::make_pair(s.get(), session.second)));
90  } else {
91  ASSERT_FALSE(s);
92  }
93  }
bool isSameSession(std::pair< SSL_SESSION *, size_t > lhs, std::pair< SSL_SESSION *, size_t > rhs)
Definition: TestUtil.cpp:368
std::unique_ptr< SSLSessionPersistentCache > cache_
static set< string > s
#define ASSERT_FALSE(condition)
Definition: gtest.h:1868
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865

Member Data Documentation

std::unique_ptr<SSLSessionPersistentCache> wangle::SSLSessionPersistentCacheTest::cache_
protected

Definition at line 98 of file SSLSessionPersistentCacheTest.cpp.

std::string wangle::SSLSessionPersistentCacheTest::filename_
protected

Definition at line 96 of file SSLSessionPersistentCacheTest.cpp.

MockTimeUtil* wangle::SSLSessionPersistentCacheTest::mockTimeUtil_
protected

Definition at line 97 of file SSLSessionPersistentCacheTest.cpp.

std::vector<std::pair<SSL_SESSION*, size_t> > wangle::SSLSessionPersistentCacheTest::sessions_
protected

Definition at line 99 of file SSLSessionPersistentCacheTest.cpp.

std::pair<SSL_SESSION*, size_t> wangle::SSLSessionPersistentCacheTest::sessionWithTicket_
protected

Definition at line 100 of file SSLSessionPersistentCacheTest.cpp.


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