proxygen
|
#include <wangle/util/MultiFilePoller.h>
#include <folly/futures/Future.h>
#include <folly/FileUtil.h>
#include <folly/MapUtil.h>
#include <folly/String.h>
#include <folly/experimental/TestUtil.h>
#include <folly/portability/GTest.h>
#include <folly/synchronization/SaturatingSemaphore.h>
Go to the source code of this file.
Classes | |
class | MultiFilePollerTest |
Functions | |
TEST_F (MultiFilePollerTest, BasicTest) | |
TEST_F (MultiFilePollerTest, CancellationTest) | |
TEST_F (MultiFilePollerTest, ComplexTest) | |
Variables | |
static const std::chrono::milliseconds | kPollIntervalMs {200} |
static const std::chrono::milliseconds | kWriteWaitMs {1000} |
static const std::chrono::milliseconds | kMaxSemaphoreWaitMs {1000} |
TEST_F | ( | MultiFilePollerTest | , |
BasicTest | |||
) |
BasicTest This test checks basic usage scenario of MultiFilePoller: (1) registers a callback on one file. (2) writes data to the file, and expects the callback to be triggered. (3) cancels the callback, and expects the callback to not run.
Definition at line 69 of file MultiFilePollerTest.cpp.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_TRUE, count, d3(), EXPECT_EQ, f, folly::get_or_throw(), kMaxSemaphoreWaitMs, now(), folly::SaturatingSemaphore< MayBlock, Atom >::post(), folly::SaturatingSemaphore< MayBlock, Atom >::reset(), string, folly::SaturatingSemaphore< MayBlock, Atom >::try_wait_until(), and folly::writeFile().
TEST_F | ( | MultiFilePollerTest | , |
CancellationTest | |||
) |
CancellationTest This test tests the basic functionality of callback cancellation.
Definition at line 109 of file MultiFilePollerTest.cpp.
References EXPECT_THROW, f, FAIL, and string.
TEST_F | ( | MultiFilePollerTest | , |
ComplexTest | |||
) |
ComplexTest This test constructs a more complex use scenario of MultiFilePoller: (1) There are three files: f1, f2, and f3. (2) There are four callbacks: cb1 = {f1} cb2 = {f2} cb3 = {f3, f1} // So f1 is used by cb1 and cb3, but cb3 also use f3. cb4 = {f2} // So cb2 and cb4 use and only use f2.
Definition at line 135 of file MultiFilePollerTest.cpp.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_NE, ASSERT_TRUE, d3(), EXPECT_EQ, folly::get_default(), folly::get_or_throw(), kMaxSemaphoreWaitMs, now(), folly::SaturatingSemaphore< MayBlock, Atom >::post(), folly::SaturatingSemaphore< MayBlock, Atom >::reset(), string, folly::SaturatingSemaphore< MayBlock, Atom >::try_wait_until(), and folly::writeFile().
|
static |
Definition at line 36 of file MultiFilePollerTest.cpp.
Referenced by TEST_F().
|
static |
Definition at line 30 of file MultiFilePollerTest.cpp.
Referenced by MultiFilePollerTest::SetUp().
|
static |
Definition at line 33 of file MultiFilePollerTest.cpp.
Referenced by MultiFilePollerTest::delayedWrite().