TEST_F(L2capLeFixedChannelImplTest, get_device) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_DEVICE_ADDRESS};
EXPECT_CALL(mock_le_link, GetDevice()).WillRepeatedly(Return(device));
LOG_INFO("------------------");
TEST_F(L2capLeFixedChannelImplTest, close_triggers_callback) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, register_callback_after_close_should_call_immediately) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, close_twice_should_fail) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, multiple_registeration_should_fail) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, call_acquire_before_registeration_should_fail) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, call_release_before_registeration_should_fail) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, test_acquire_release_channel) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);
TEST_F(L2capLeFixedChannelImplTest, test_acquire_after_close) {
MockParameterProvider mock_parameter_provider;
- MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider);
+ EXPECT_CALL(mock_parameter_provider, GetLeLinkIdleDisconnectTimeout()).Times(1);
+ testing::MockAclConnection* mock_acl_connection = new testing::MockAclConnection();
+ EXPECT_CALL(*mock_acl_connection, GetAddress()).Times(1);
+ EXPECT_CALL(*mock_acl_connection, GetAddressType()).Times(1);
+ MockLink mock_le_link(l2cap_handler_, &mock_parameter_provider,
+ std::unique_ptr<testing::MockAclConnection>(mock_acl_connection));
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_);