#include "device/bluetooth/gatt_service.h"
#include "base/test/bind.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
#include "device/bluetooth/test/fake_local_gatt_characteristic.h"
#include "device/bluetooth/test/fake_local_gatt_service.h"
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
#include "device/bluetooth/test/mock_bluetooth_device.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kServiceId[] = …;
const char kCharacteristicUuid[] = …;
const char kTestDeviceName[] = …;
const char kTestDeviceAddress[] = …;
const std::vector<uint8_t> kReadCharacteristicValue = …;
const int kReadCharacteristicOffset = …;
std::unique_ptr<bluetooth::FakeLocalGattCharacteristic>
CreateFakeCharacteristic(device::BluetoothLocalGattService* service) { … }
std::unique_ptr<testing::NiceMock<device::MockBluetoothDevice>>
CreateMockBluetoothDevice() { … }
}
namespace bluetooth {
class GattServiceTest : public testing::Test,
public mojom::GattServiceObserver { … };
TEST_F(GattServiceTest, CreateGattServiceOnConstruction) { … }
TEST_F(GattServiceTest, CreateCharacteristic_FailureIfGattServiceIsDestroyed) { … }
TEST_F(GattServiceTest,
CreateCharacteristic_FailureIfCreateGattCharacteristicFails) { … }
TEST_F(GattServiceTest, CreateCharacteristic_SuccessIfCreated) { … }
TEST_F(GattServiceTest,
CreateCharacteristic_Success_MultiplePermissionsAndProperties) { … }
TEST_F(GattServiceTest, OnReadCharacteristic_Success) { … }
TEST_F(GattServiceTest, OnReadCharacteristic_Failure) { … }
TEST_F(GattServiceTest, MojoDisconnect_GattServiceRemote) { … }
TEST_F(GattServiceTest, MojoDisconnect_GattServiceObserverRemote) { … }
TEST_F(GattServiceTest, Register_Success) { … }
TEST_F(GattServiceTest, Register_Failure) { … }
}