proxygen
folly::AsyncSSLSocketWriteTest Class Reference
Inheritance diagram for folly::AsyncSSLSocketWriteTest:
testing::Test

Public Member Functions

 AsyncSSLSocketWriteTest ()
 
std::unique_ptr< iovec[]> makeVec (std::vector< uint32_t > sizes)
 
void verifyVec (const void *buf, int n, int pos)
 
void consumeVec (iovec *vec, uint32_t countWritten, uint32_t partialWritten)
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Public Attributes

EventBase eventBase_
 
std::shared_ptr< SSLContextsslContext_
 
std::shared_ptr< MockAsyncSSLSocketsock_
 
char source_ [26 *500]
 

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)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Detailed Description

Definition at line 77 of file AsyncSSLSocketWriteTest.cpp.

Constructor & Destructor Documentation

folly::AsyncSSLSocketWriteTest::AsyncSSLSocketWriteTest ( )
inline

Definition at line 79 of file AsyncSSLSocketWriteTest.cpp.

References i.

80  : sslContext_(new SSLContext()),
82  for (int i = 0; i < 500; i++) {
83  memcpy(source_ + i * 26, "abcdefghijklmnopqrstuvwxyz", 26);
84  }
85  }
std::shared_ptr< MockAsyncSSLSocket > sock_
std::shared_ptr< SSLContext > sslContext_
static std::shared_ptr< MockAsyncSSLSocket > newSocket(const std::shared_ptr< SSLContext > &ctx, EventBase *evb)

Member Function Documentation

void folly::AsyncSSLSocketWriteTest::consumeVec ( iovec *  vec,
uint32_t  countWritten,
uint32_t  partialWritten 
)
inline

Definition at line 107 of file AsyncSSLSocketWriteTest.cpp.

107  {
108  vec[countWritten].iov_base =
109  ((char*)vec[countWritten].iov_base) + partialWritten;
110  vec[countWritten].iov_len -= partialWritten;
111  }
Definition: Traits.h:588
std::unique_ptr<iovec[]> folly::AsyncSSLSocketWriteTest::makeVec ( std::vector< uint32_t sizes)
inline

Definition at line 89 of file AsyncSSLSocketWriteTest.cpp.

References i, and folly::size().

89  {
90  std::unique_ptr<iovec[]> vec(new iovec[sizes.size()]);
91  int i = 0;
92  int pos = 0;
93  for (auto size : sizes) {
94  vec[i].iov_base = (void*)(source_ + pos);
95  vec[i++].iov_len = size;
96  pos += size;
97  }
98  return vec;
99  }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
Definition: Traits.h:588
vector< string > vec
Definition: StringTest.cpp:35
void folly::AsyncSSLSocketWriteTest::verifyVec ( const void *  buf,
int  n,
int  pos 
)
inline

Definition at line 102 of file AsyncSSLSocketWriteTest.cpp.

References ASSERT_EQ.

102  {
103  ASSERT_EQ(memcmp(source_ + pos, buf, n), 0);
104  }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956

Member Data Documentation

EventBase folly::AsyncSSLSocketWriteTest::eventBase_

Definition at line 113 of file AsyncSSLSocketWriteTest.cpp.

std::shared_ptr<MockAsyncSSLSocket> folly::AsyncSSLSocketWriteTest::sock_

Definition at line 115 of file AsyncSSLSocketWriteTest.cpp.

char folly::AsyncSSLSocketWriteTest::source_[26 *500]

Definition at line 116 of file AsyncSSLSocketWriteTest.cpp.

std::shared_ptr<SSLContext> folly::AsyncSSLSocketWriteTest::sslContext_

Definition at line 114 of file AsyncSSLSocketWriteTest.cpp.


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