19 #include <gmock/gmock.h> 20 #include <gtest/gtest.h> 24 using namespace folly;
33 MOCK_METHOD1(peekSuccess_,
void(
typename std::vector<uint8_t>));
35 peekSuccess_(peekBytes);
60 if (arg.size() != size_t(len)) {
62 }
else if (len == 0) {
65 return memcmp(buf, arg.data(), len) == 0;
79 peeker->getReadBuffer(reinterpret_cast<void**>(&buf), &len);
84 EXPECT_CALL(*sock, _setPreReceivedData(IOBufMatches(buf, 2)));
85 EXPECT_CALL(callback, peekSuccess_(BufMatches(buf, 2)));
88 peeker->readDataAvailable(2);
108 peeker->getReadBuffer(reinterpret_cast<void**>(&buf), &len);
111 peeker->readDataAvailable(1);
125 peeker->getReadBuffer(reinterpret_cast<void**>(&buf), &len);
128 peeker->readDataAvailable(1);
130 peeker->getReadBuffer(reinterpret_cast<void**>(&buf), &len);
134 EXPECT_CALL(*sock, _setPreReceivedData(IOBufMatches(
"\x16\x03", 2)));
135 EXPECT_CALL(callback, peekSuccess_(BufMatches(
"\x16\x03", 2)));
137 peeker->readDataAvailable(1);
151 EXPECT_CALL(callback, peekSuccess_(BufMatches(&buf, 0)));
#define EXPECT_EQ(val1, val2)
MockSocketPeekerCallback callback
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
void peekSuccess(std::vector< uint8_t > peekBytes) noexceptoverride
MATCHER_P2(BufMatches, buf, len,"")
#define MOCK_METHOD1(m,...)
void peekError(const folly::AsyncSocketException &ex) noexceptoverride
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
TEST_F(FileUtilTest, read)
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
std::unique_ptr< SocketPeeker, folly::DelayedDestruction::Destructor > UniquePtr