mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Revert "removed bluetooth_classic_socket specific stream semantics. all linux sockets should use stream.h. improved stream semantics in stream.h"
This reverts commit 18970db598.
This commit is contained in:
@@ -14,11 +14,12 @@
|
||||
|
||||
#include "internal/platform/implementation/timer.h"
|
||||
|
||||
#include <chrono> // NOLINT
|
||||
// NOLINT
|
||||
#include <memory>
|
||||
#include <thread> // NOLINT
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/count_down_latch.h"
|
||||
#include "internal/platform/implementation/platform.h"
|
||||
|
||||
namespace nearby {
|
||||
@@ -37,21 +38,29 @@ TEST(Timer, TestCreateTimer) {
|
||||
}
|
||||
|
||||
// This test case cannot run on Google3
|
||||
TEST(Timer, TestRepeatTimer) {
|
||||
CountDownLatch latch(3);
|
||||
TEST(Timer, DISABLED_TestRepeatTimer) {
|
||||
int count = 0;
|
||||
|
||||
std::unique_ptr<nearby::api::Timer> timer =
|
||||
nearby::api::ImplementationPlatform::CreateTimer();
|
||||
|
||||
ASSERT_TRUE(timer != nullptr);
|
||||
EXPECT_TRUE(timer->Create(300, 300, [&]() {
|
||||
++count;
|
||||
latch.CountDown();
|
||||
}));
|
||||
|
||||
EXPECT_TRUE(latch.Await(absl::Seconds(2)));
|
||||
EXPECT_EQ(count, 3);
|
||||
EXPECT_TRUE(timer->Create(300, 300, [&]() { ++count; }));
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
EXPECT_TRUE(timer->Stop());
|
||||
EXPECT_EQ(count, 3);
|
||||
}
|
||||
|
||||
TEST(Timer, DISABLED_TestFireNow) {
|
||||
int count = 0;
|
||||
|
||||
auto timer = nearby::api::ImplementationPlatform::CreateTimer();
|
||||
|
||||
EXPECT_TRUE(timer != nullptr);
|
||||
EXPECT_TRUE(timer->Create(3000, 3000, [&]() { ++count; }));
|
||||
EXPECT_TRUE(timer->FireNow());
|
||||
EXPECT_TRUE(timer->Stop());
|
||||
EXPECT_EQ(count, 1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user