Loading system/gd/l2cap/le/fixed_channel.cc +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ namespace bluetooth { namespace l2cap { namespace le { hci::Address FixedChannel::GetDevice() const { hci::AddressWithType FixedChannel::GetDevice() const { return impl_->GetDevice(); } Loading system/gd/l2cap/le/fixed_channel.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class FixedChannel { ASSERT(l2cap_handler_ != nullptr); } hci::Address GetDevice() const; hci::AddressWithType GetDevice() const; /** * Register close callback. If close callback is registered, when a channel is closed, the channel's resource will Loading system/gd/l2cap/le/internal/fixed_channel_impl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ namespace internal { FixedChannelImpl::FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler) : cid_(cid), device_(link->GetDevice()), link_(link), l2cap_handler_(l2cap_handler) { ASSERT_LOG(cid_ >= kFirstFixedChannel && cid_ <= kLastFixedChannel, "Invalid cid: %d", cid_); ASSERT(!device_.IsEmpty()); ASSERT(!device_.GetAddress().IsEmpty()); ASSERT(link_ != nullptr); ASSERT(l2cap_handler_ != nullptr); } Loading system/gd/l2cap/le/internal/fixed_channel_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class FixedChannelImpl { virtual ~FixedChannelImpl() = default; hci::Address GetDevice() const { hci::AddressWithType GetDevice() const { return device_; } Loading Loading @@ -70,7 +70,7 @@ class FixedChannelImpl { // For logging purpose only const Cid cid_; // For logging purpose only const hci::Address device_; const hci::AddressWithType device_; // Needed to handle Acquire() and Release() Link* link_; os::Handler* l2cap_handler_; Loading system/gd/l2cap/le/internal/fixed_channel_impl_test.cc +11 −9 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ namespace l2cap { namespace le { namespace internal { using hci::Address; using hci::AddressWithType; using l2cap::internal::testing::MockParameterProvider; using testing::MockLink; using ::testing::Return; Loading Loading @@ -61,7 +63,7 @@ class L2capLeFixedChannelImplTest : public ::testing::Test { TEST_F(L2capLeFixedChannelImplTest, get_device) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_EQ(device, fixed_channel_impl.GetDevice()); Loading @@ -70,7 +72,7 @@ TEST_F(L2capLeFixedChannelImplTest, get_device) { TEST_F(L2capLeFixedChannelImplTest, close_triggers_callback) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -91,7 +93,7 @@ TEST_F(L2capLeFixedChannelImplTest, close_triggers_callback) { TEST_F(L2capLeFixedChannelImplTest, register_callback_after_close_should_call_immediately) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -112,7 +114,7 @@ TEST_F(L2capLeFixedChannelImplTest, register_callback_after_close_should_call_im TEST_F(L2capLeFixedChannelImplTest, close_twice_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -136,7 +138,7 @@ TEST_F(L2capLeFixedChannelImplTest, close_twice_should_fail) { TEST_F(L2capLeFixedChannelImplTest, multiple_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -156,7 +158,7 @@ TEST_F(L2capLeFixedChannelImplTest, multiple_registeration_should_fail) { TEST_F(L2capLeFixedChannelImplTest, call_acquire_before_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_DEATH(fixed_channel_impl.Acquire(), ".*Acquire.*"); Loading @@ -165,7 +167,7 @@ TEST_F(L2capLeFixedChannelImplTest, call_acquire_before_registeration_should_fai TEST_F(L2capLeFixedChannelImplTest, call_release_before_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_DEATH(fixed_channel_impl.Release(), ".*Release.*"); Loading @@ -174,7 +176,7 @@ TEST_F(L2capLeFixedChannelImplTest, call_release_before_registeration_should_fai TEST_F(L2capLeFixedChannelImplTest, test_acquire_release_channel) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading Loading @@ -202,7 +204,7 @@ TEST_F(L2capLeFixedChannelImplTest, test_acquire_release_channel) { TEST_F(L2capLeFixedChannelImplTest, test_acquire_after_close) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading Loading
system/gd/l2cap/le/fixed_channel.cc +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ namespace bluetooth { namespace l2cap { namespace le { hci::Address FixedChannel::GetDevice() const { hci::AddressWithType FixedChannel::GetDevice() const { return impl_->GetDevice(); } Loading
system/gd/l2cap/le/fixed_channel.h +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ class FixedChannel { ASSERT(l2cap_handler_ != nullptr); } hci::Address GetDevice() const; hci::AddressWithType GetDevice() const; /** * Register close callback. If close callback is registered, when a channel is closed, the channel's resource will Loading
system/gd/l2cap/le/internal/fixed_channel_impl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ namespace internal { FixedChannelImpl::FixedChannelImpl(Cid cid, Link* link, os::Handler* l2cap_handler) : cid_(cid), device_(link->GetDevice()), link_(link), l2cap_handler_(l2cap_handler) { ASSERT_LOG(cid_ >= kFirstFixedChannel && cid_ <= kLastFixedChannel, "Invalid cid: %d", cid_); ASSERT(!device_.IsEmpty()); ASSERT(!device_.GetAddress().IsEmpty()); ASSERT(link_ != nullptr); ASSERT(l2cap_handler_ != nullptr); } Loading
system/gd/l2cap/le/internal/fixed_channel_impl.h +2 −2 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class FixedChannelImpl { virtual ~FixedChannelImpl() = default; hci::Address GetDevice() const { hci::AddressWithType GetDevice() const { return device_; } Loading Loading @@ -70,7 +70,7 @@ class FixedChannelImpl { // For logging purpose only const Cid cid_; // For logging purpose only const hci::Address device_; const hci::AddressWithType device_; // Needed to handle Acquire() and Release() Link* link_; os::Handler* l2cap_handler_; Loading
system/gd/l2cap/le/internal/fixed_channel_impl_test.cc +11 −9 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ namespace l2cap { namespace le { namespace internal { using hci::Address; using hci::AddressWithType; using l2cap::internal::testing::MockParameterProvider; using testing::MockLink; using ::testing::Return; Loading Loading @@ -61,7 +63,7 @@ class L2capLeFixedChannelImplTest : public ::testing::Test { TEST_F(L2capLeFixedChannelImplTest, get_device) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_EQ(device, fixed_channel_impl.GetDevice()); Loading @@ -70,7 +72,7 @@ TEST_F(L2capLeFixedChannelImplTest, get_device) { TEST_F(L2capLeFixedChannelImplTest, close_triggers_callback) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -91,7 +93,7 @@ TEST_F(L2capLeFixedChannelImplTest, close_triggers_callback) { TEST_F(L2capLeFixedChannelImplTest, register_callback_after_close_should_call_immediately) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -112,7 +114,7 @@ TEST_F(L2capLeFixedChannelImplTest, register_callback_after_close_should_call_im TEST_F(L2capLeFixedChannelImplTest, close_twice_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -136,7 +138,7 @@ TEST_F(L2capLeFixedChannelImplTest, close_twice_should_fail) { TEST_F(L2capLeFixedChannelImplTest, multiple_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading @@ -156,7 +158,7 @@ TEST_F(L2capLeFixedChannelImplTest, multiple_registeration_should_fail) { TEST_F(L2capLeFixedChannelImplTest, call_acquire_before_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_DEATH(fixed_channel_impl.Acquire(), ".*Acquire.*"); Loading @@ -165,7 +167,7 @@ TEST_F(L2capLeFixedChannelImplTest, call_acquire_before_registeration_should_fai TEST_F(L2capLeFixedChannelImplTest, call_release_before_registeration_should_fail) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); EXPECT_DEATH(fixed_channel_impl.Release(), ".*Release.*"); Loading @@ -174,7 +176,7 @@ TEST_F(L2capLeFixedChannelImplTest, call_release_before_registeration_should_fai TEST_F(L2capLeFixedChannelImplTest, test_acquire_release_channel) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading Loading @@ -202,7 +204,7 @@ TEST_F(L2capLeFixedChannelImplTest, test_acquire_release_channel) { TEST_F(L2capLeFixedChannelImplTest, test_acquire_after_close) { MockParameterProvider mock_parameter_provider; MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider); hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS}; EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device)); FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_le_link, l2cap_handler_); Loading