mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fixed one GATT crash
PiperOrigin-RevId: 657684638
This commit is contained in:
committed by
Copybara-Service
parent
68d432c5a8
commit
4d457d134b
@@ -14,10 +14,13 @@
|
||||
|
||||
#include "internal/platform/implementation/windows/ble_gatt_server.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/synchronization/notification.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/implementation/ble_v2.h"
|
||||
#include "internal/platform/implementation/windows/bluetooth_adapter.h"
|
||||
|
||||
@@ -44,6 +47,23 @@ TEST(BleV2GattServer, DISABLED_Stop) {
|
||||
blev2_gatt_server.Stop();
|
||||
}
|
||||
|
||||
TEST(BleV2GattServer, DISABLED_StopNotifierIsCalled) {
|
||||
BluetoothAdapter bluetoothAdapter;
|
||||
BleGattServer blev2_gatt_server(&bluetoothAdapter, {});
|
||||
bool is_close_notifier_called = false;
|
||||
absl::Notification notification;
|
||||
std::function<void()> notifier = [&is_close_notifier_called,
|
||||
¬ification]() {
|
||||
is_close_notifier_called = true;
|
||||
notification.Notify();
|
||||
};
|
||||
blev2_gatt_server.SetCloseNotifier(std::move(notifier));
|
||||
|
||||
blev2_gatt_server.Stop();
|
||||
notification.WaitForNotificationWithTimeout(absl::Seconds(1));
|
||||
EXPECT_TRUE(is_close_notifier_called);
|
||||
}
|
||||
|
||||
TEST(BleV2GattServer, DISABLED_CreateCharacteristic) {
|
||||
BluetoothAdapter bluetoothAdapter;
|
||||
BleGattServer blev2_gatt_server(&bluetoothAdapter, {});
|
||||
|
||||
Reference in New Issue
Block a user