From e3f19887ba735918049bad35b3b7ce0780552718 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Fri, 30 Apr 2021 16:45:51 -0700 Subject: [PATCH] ScanningManagerTest: Wait for the Filter command Bug: 176832968 Test: atest bluetooth_test_gd Tag: #gd-refactor Change-Id: Idf36458a196e1ad3278f3eb8a2d384586ac40afe --- gd/hci/le_scanning_manager_test.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gd/hci/le_scanning_manager_test.cc b/gd/hci/le_scanning_manager_test.cc index 5cb60f891..d7adeae7f 100644 --- a/gd/hci/le_scanning_manager_test.cc +++ b/gd/hci/le_scanning_manager_test.cc @@ -154,6 +154,7 @@ class TestHciLayer : public HciLayer { void CommandCompleteCallback(EventView event) { CommandCompleteView complete_view = CommandCompleteView::Create(event); ASSERT_TRUE(complete_view.IsValid()); + ASSERT_NE(command_complete_callbacks.size(), 0); std::move(command_complete_callbacks.front()).Invoke(complete_view); command_complete_callbacks.pop_front(); } @@ -161,6 +162,7 @@ class TestHciLayer : public HciLayer { void CommandStatusCallback(EventView event) { CommandStatusView status_view = CommandStatusView::Create(event); ASSERT_TRUE(status_view.IsValid()); + ASSERT_NE(command_status_callbacks.size(), 0); std::move(command_status_callbacks.front()).Invoke(status_view); command_status_callbacks.pop_front(); } @@ -455,6 +457,8 @@ TEST_F(LeAndroidHciScanningManagerTest, scan_filter_add_test) { filters.push_back(filter); le_scanning_manager->ScanFilterAdd(0x01, filters); EXPECT_CALL(mock_callbacks_, OnFilterConfigCallback); + auto result = next_command_future.wait_for(std::chrono::duration(std::chrono::milliseconds(100))); + ASSERT_EQ(std::future_status::ready, result); test_hci_layer_->IncomingEvent( LeAdvFilterBroadcasterAddressCompleteBuilder::Create(uint8_t{1}, ErrorCode::SUCCESS, ApcfAction::ADD, 0x0a)); sync_client_handler(); -- 2.11.0