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:
lasan
2026-06-11 12:42:59 +05:30
parent 18970db598
commit 844bf42e7e
11 changed files with 424 additions and 230 deletions
@@ -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