src/connectivity/bluetooth/core/bt-host/fidl/low_energy_central_server_unittest.cc
// Tests that setting ConnectionOptions.bondable_mode to true and connecting to a peer in bondable
// mode results in a bondable connection ref being stored in LowEnergyConnectionManager
Tests that setting ConnectionOptions.bondable_mode to true and connecting to a peer in bondable
mode results in a bondable connection ref being stored in LowEnergyConnectionManager
Tests that setting ConnectionOptions . bondable_mode to true and connecting to a peer in bondable mode results in a bondable connection ref being stored in LowEnergyConnectionManager
TEST_F(FIDL_LowEnergyCentralServerTest, ConnectBondableResultsBondableConnectionRef) {
  auto* const peer = adapter()->peer_cache()->NewPeer(kTestAddr, true);
  ASSERT_TRUE(peer);
  test_device()->AddPeer(std::make_unique<bt::testing::FakePeer>(kTestAddr));
  fble::ConnectionOptions options;
  options.set_bondable_mode(true);
  fidl::InterfaceHandle<fuchsia::bluetooth::gatt::Client> gatt_client;
  fidl::InterfaceRequest<fuchsia::bluetooth::gatt::Client> gatt_client_req =
      gatt_client.NewRequest();
  auto status =
      fidl_helpers::NewFidlError(fuchsia::bluetooth::ErrorCode::BAD_STATE, "this should change");
  auto callback = [&status](::fuchsia::bluetooth::Status cb_status) {
    ASSERT_EQ(cb_status.error, nullptr);
    status = std::move(cb_status);
  };
  central_proxy()->ConnectPeripheral(peer->identifier().ToString(), std::move(options),
                                     std::move(gatt_client_req), callback);
  ASSERT_FALSE(server()->FindConnectionForTesting(peer->identifier()));
  RunLoopUntilIdle();
  auto conn_ref_ptr = server()->FindConnectionForTesting(peer->identifier());
  ASSERT_EQ(status.error, nullptr);
  ASSERT_TRUE(conn_ref_ptr);
  ASSERT_EQ(conn_ref_ptr->bondable_mode(), bt::sm::BondableMode::Bondable);
}
TEST_F ( FIDL_LowEnergyCentralServerTest , ConnectBondableResultsBondableConnectionRef ) { auto * const peer = adapter ( ) -> peer_cache ( ) -> NewPeer ( kTestAddr , true ) ; ASSERT_TRUE ( peer ) ; test_device ( ) -> AddPeer ( std :: make_unique < bt :: testing :: FakePeer > ( kTestAddr ) ) ; fble :: ConnectionOptions options ; options . set_bondable_mode ( true ) ; fidl :: InterfaceHandle < fuchsia :: bluetooth :: gatt :: Client > gatt_client ; fidl :: InterfaceRequest < fuchsia :: bluetooth :: gatt :: Client > gatt_client_req = gatt_client . NewRequest ( ) ; auto status = fidl_helpers :: NewFidlError ( fuchsia :: bluetooth :: ErrorCode :: BAD_STATE , " " ) ; auto callback = [ & status ] ( :: fuchsia :: bluetooth :: Status cb_status ) { ASSERT_EQ ( cb_status . error , nullptr ) ; status = std :: move ( cb_status ) ; } ; central_proxy ( ) -> ConnectPeripheral ( peer -> identifier ( ) . ToString ( ) , std :: move ( options ) , std :: move ( gatt_client_req ) , callback ) ; ASSERT_FALSE ( server ( ) -> FindConnectionForTesting ( peer -> identifier ( ) ) ) ; RunLoopUntilIdle ( ) ; auto conn_ref_ptr = server ( ) -> FindConnectionForTesting ( peer -> identifier ( ) ) ; ASSERT_EQ ( status . error , nullptr ) ; ASSERT_TRUE ( conn_ref_ptr ) ; ASSERT_EQ ( conn_ref_ptr -> bondable_mode ( ) , bt :: sm :: BondableMode :: Bondable ) ; }
Tests that setting ConnectionOptions.bondable_mode to true and connecting to a peer in bondable
mode results in a bondable connection ref being stored in LowEnergyConnectionManager
Tests that setting ConnectionOptions . bondable_mode to true and connecting to a peer in bondable mode results in a bondable connection ref being stored in LowEnergyConnectionManager
/*connectable=*/