Loading system/bta/le_audio/codec_manager_test.cc +10 −10 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ class CodecManagerTestBase : public Test { .WillByDefault(Return(true)); controller::SetMockControllerInterface(&controller_interface); Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock()); bluetooth::legacy::hci::testing::SetMock(legacy_hci_mock_); codec_manager = CodecManager::GetInstance(); } Loading @@ -96,12 +96,12 @@ class CodecManagerTestBase : public Test { virtual void TearDown() override { codec_manager->Stop(); Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock()); controller::SetMockControllerInterface(nullptr); } NiceMock<controller::MockControllerInterface> controller_interface; CodecManager* codec_manager; bluetooth::legacy::hci::testing::MockInterface legacy_hci_mock_; }; /*----------------- ADSP codec manager tests ------------------*/ Loading @@ -121,21 +121,21 @@ TEST_F(CodecManagerTestAdsp, test_init) { } TEST_F(CodecManagerTestAdsp, test_start) { EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathPlatformDefault, _)) .Times(1); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathPlatformDefault, _)) .Times(1); // Verify data path is reset on Stop() EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathHci, _)) .Times(1); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathHci, _)) .Times(1); Loading Loading @@ -343,21 +343,21 @@ TEST_F(CodecManagerTestHost, test_init) { } TEST_F(CodecManagerTestHost, test_start) { EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathPlatformDefault, _)) .Times(0); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathPlatformDefault, _)) .Times(0); // Verify data path is NOT reset on Stop() for the Host encoding session EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathHci, _)) .Times(0); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathHci, _)) .Times(0); Loading system/stack/test/btm/stack_btm_test.cc +8 −11 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class StackBtmWithQueuesTest : public StackBtmTest { down_handler_ = new bluetooth::os::Handler(down_thread_); bluetooth::hci::testing::mock_hci_layer_ = &mock_hci_; bluetooth::hci::testing::mock_gd_shim_handler_ = up_handler_; bluetooth::legacy::hci::testing::SetMock(legacy_hci_mock_); } void TearDown() override { up_handler_->Clear(); Loading @@ -93,6 +94,7 @@ class StackBtmWithQueuesTest : public StackBtmTest { bluetooth::hci::ScoBuilder> sco_queue_{10}; bluetooth::hci::testing::MockHciLayer mock_hci_; bluetooth::legacy::hci::testing::MockInterface legacy_hci_mock_; bluetooth::os::Thread* up_thread_; bluetooth::os::Handler* up_handler_; bluetooth::os::Thread* down_thread_; Loading Loading @@ -199,20 +201,15 @@ TEST_F(StackBtmWithQueuesTest, change_packet_type) { uint64_t features = 0xffffffffffffffff; acl_process_supported_features(0x123, features); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType(handle, 0x4400 | HCI_PKT_TYPES_MASK_DM1)); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); EXPECT_CALL(legacy_hci_mock_, ChangeConnectionPacketType( handle, 0x4400 | HCI_PKT_TYPES_MASK_DM1)); EXPECT_CALL(legacy_hci_mock_, ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); btm_set_packet_types_from_address(bda, 0x55aa); btm_set_packet_types_from_address(bda, 0xffff); // Illegal mask, won't be sent. btm_set_packet_types_from_address(bda, 0x0); get_btm_client_interface().lifecycle.btm_free(); Loading system/test/mock/mock_legacy_hci_interface.cc +3 −3 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ namespace bluetooth::legacy::hci { namespace testing { MockInterface interface_; MockInterface& GetMock() { return interface_; } const MockInterface* interface_; void SetMock(const MockInterface& mock) { interface_ = &mock; } } // namespace testing const Interface& GetInterface() { return testing::interface_; } const Interface& GetInterface() { return *testing::interface_; } } // namespace bluetooth::legacy::hci system/test/mock/mock_legacy_hci_interface.h +3 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #include "stack/include/hcimsgs.h" namespace bluetooth::legacy::hci { namespace bluetooth::legacy::hci::testing { class MockInterface : public Interface { public: MOCK_METHOD(void, StartInquiry, Loading @@ -37,7 +37,5 @@ class MockInterface : public Interface { std::vector<uint8_t> vendor_config), (const)); }; namespace testing { bluetooth::legacy::hci::MockInterface& GetMock(); } } // namespace bluetooth::legacy::hci No newline at end of file void SetMock(const MockInterface& interface); } // namespace bluetooth::legacy::hci::testing Loading
system/bta/le_audio/codec_manager_test.cc +10 −10 Original line number Diff line number Diff line Loading @@ -88,7 +88,7 @@ class CodecManagerTestBase : public Test { .WillByDefault(Return(true)); controller::SetMockControllerInterface(&controller_interface); Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock()); bluetooth::legacy::hci::testing::SetMock(legacy_hci_mock_); codec_manager = CodecManager::GetInstance(); } Loading @@ -96,12 +96,12 @@ class CodecManagerTestBase : public Test { virtual void TearDown() override { codec_manager->Stop(); Mock::VerifyAndClearExpectations(&bluetooth::legacy::hci::testing::GetMock()); controller::SetMockControllerInterface(nullptr); } NiceMock<controller::MockControllerInterface> controller_interface; CodecManager* codec_manager; bluetooth::legacy::hci::testing::MockInterface legacy_hci_mock_; }; /*----------------- ADSP codec manager tests ------------------*/ Loading @@ -121,21 +121,21 @@ TEST_F(CodecManagerTestAdsp, test_init) { } TEST_F(CodecManagerTestAdsp, test_start) { EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathPlatformDefault, _)) .Times(1); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathPlatformDefault, _)) .Times(1); // Verify data path is reset on Stop() EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathHci, _)) .Times(1); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathHci, _)) .Times(1); Loading Loading @@ -343,21 +343,21 @@ TEST_F(CodecManagerTestHost, test_init) { } TEST_F(CodecManagerTestHost, test_start) { EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathPlatformDefault, _)) .Times(0); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathPlatformDefault, _)) .Times(0); // Verify data path is NOT reset on Stop() for the Host encoding session EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::HOST_TO_CONTROLLER, kIsoDataPathHci, _)) .Times(0); EXPECT_CALL(bluetooth::legacy::hci::testing::GetMock(), EXPECT_CALL(legacy_hci_mock_, ConfigureDataPath(hci_data_direction_t::CONTROLLER_TO_HOST, kIsoDataPathHci, _)) .Times(0); Loading
system/stack/test/btm/stack_btm_test.cc +8 −11 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ class StackBtmWithQueuesTest : public StackBtmTest { down_handler_ = new bluetooth::os::Handler(down_thread_); bluetooth::hci::testing::mock_hci_layer_ = &mock_hci_; bluetooth::hci::testing::mock_gd_shim_handler_ = up_handler_; bluetooth::legacy::hci::testing::SetMock(legacy_hci_mock_); } void TearDown() override { up_handler_->Clear(); Loading @@ -93,6 +94,7 @@ class StackBtmWithQueuesTest : public StackBtmTest { bluetooth::hci::ScoBuilder> sco_queue_{10}; bluetooth::hci::testing::MockHciLayer mock_hci_; bluetooth::legacy::hci::testing::MockInterface legacy_hci_mock_; bluetooth::os::Thread* up_thread_; bluetooth::os::Handler* up_handler_; bluetooth::os::Thread* down_thread_; Loading Loading @@ -199,20 +201,15 @@ TEST_F(StackBtmWithQueuesTest, change_packet_type) { uint64_t features = 0xffffffffffffffff; acl_process_supported_features(0x123, features); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType(handle, 0x4400 | HCI_PKT_TYPES_MASK_DM1)); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); EXPECT_CALL( bluetooth::legacy::hci::testing::GetMock(), ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); EXPECT_CALL(legacy_hci_mock_, ChangeConnectionPacketType( handle, 0x4400 | HCI_PKT_TYPES_MASK_DM1)); EXPECT_CALL(legacy_hci_mock_, ChangeConnectionPacketType( handle, (0xcc00 | HCI_PKT_TYPES_MASK_DM1 | HCI_PKT_TYPES_MASK_DH1))); btm_set_packet_types_from_address(bda, 0x55aa); btm_set_packet_types_from_address(bda, 0xffff); // Illegal mask, won't be sent. btm_set_packet_types_from_address(bda, 0x0); get_btm_client_interface().lifecycle.btm_free(); Loading
system/test/mock/mock_legacy_hci_interface.cc +3 −3 Original line number Diff line number Diff line Loading @@ -22,8 +22,8 @@ namespace bluetooth::legacy::hci { namespace testing { MockInterface interface_; MockInterface& GetMock() { return interface_; } const MockInterface* interface_; void SetMock(const MockInterface& mock) { interface_ = &mock; } } // namespace testing const Interface& GetInterface() { return testing::interface_; } const Interface& GetInterface() { return *testing::interface_; } } // namespace bluetooth::legacy::hci
system/test/mock/mock_legacy_hci_interface.h +3 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ #include "stack/include/hcimsgs.h" namespace bluetooth::legacy::hci { namespace bluetooth::legacy::hci::testing { class MockInterface : public Interface { public: MOCK_METHOD(void, StartInquiry, Loading @@ -37,7 +37,5 @@ class MockInterface : public Interface { std::vector<uint8_t> vendor_config), (const)); }; namespace testing { bluetooth::legacy::hci::MockInterface& GetMock(); } } // namespace bluetooth::legacy::hci No newline at end of file void SetMock(const MockInterface& interface); } // namespace bluetooth::legacy::hci::testing