chromium/device/bluetooth/floss/floss_adapter_client_unittest.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "device/bluetooth/floss/floss_adapter_client.h"

#include <utility>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "dbus/mock_exported_object.h"
#include "dbus/mock_object_proxy.h"
#include "dbus/object_path.h"
#include "device/bluetooth/floss/floss_dbus_client.h"
#include "device/bluetooth/floss/floss_manager_client.h"
#include "device/bluetooth/floss/test_helpers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

_;

constexpr char kTestMethod0[] =;
constexpr char kTestMethod1[] =;
constexpr char kTestMethod2[] =;

constexpr uint8_t kFakeU8Return =;
constexpr uint32_t kFakeU32Return =;
constexpr char kFakeStrReturn[] =;
constexpr uint32_t kFakeU32Param =;
constexpr char kFakeStrParam[] =;
constexpr bool kFakeBoolParam =;
constexpr uint32_t kFakeCallbackId =;
constexpr uint32_t kFakeConnectionCallbackId =;

constexpr char kFakeDeviceAddr[] =;
constexpr char kFakeDeviceName[] =;
constexpr uint8_t kFakeBytes[] =;
constexpr uint8_t kFakeUuidByteArray[] =;
constexpr char kFakeUuidStr[] =;
constexpr floss::FlossAdapterClient::BluetoothDeviceType kFakeType =;

}  // namespace

namespace floss {
namespace {

class TestAdapterObserver : public FlossAdapterClient::Observer {};

}  // namespace

class FlossAdapterClientTest : public testing::Test {};

// Verify initial states and assumptions.
TEST_F(FlossAdapterClientTest, InitializesCorrectly) {}

TEST_F(FlossAdapterClientTest, HandlesAddressChanges) {}

TEST_F(FlossAdapterClientTest, HandlesNameChanges) {}

TEST_F(FlossAdapterClientTest, HandlesDiscoverableChanges) {}

TEST_F(FlossAdapterClientTest, HandlesDiscoveryChanges) {}

TEST_F(FlossAdapterClientTest, HandlesFoundDevices) {}

TEST_F(FlossAdapterClientTest, HandlesClearedDevices) {}

// Block the event in LaCrOS so it won't race with AshChrome. See b/308988818.
// TODO(b/274706838): Redesign DBus API so it's only received by the correct
// client.
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
TEST_F(FlossAdapterClientTest, HandlesSsp) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_LACROS)

TEST_F(FlossAdapterClientTest, CreateBond) {}

TEST_F(FlossAdapterClientTest, CallAdapterMethods) {}

TEST_F(FlossAdapterClientTest, GenericMethodGetConnectionState) {}

TEST_F(FlossAdapterClientTest,
       GenericMethodConnectAndDisconnectAllEnabledProfiles) {}

TEST_F(FlossAdapterClientTest, GenericMethodSetPairingConfirmation) {}

TEST_F(FlossAdapterClientTest, GenericMethodSetPasskey) {}

TEST_F(FlossAdapterClientTest, GenericMethodGetRemoteUuids) {}

TEST_F(FlossAdapterClientTest, GenericMethodGetRemoteType) {}

TEST_F(FlossAdapterClientTest, OnAdapterPropertyChanged) {}

}  // namespace floss