Merge "Bluetooth: Remove credit check from Loopback tests" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot 2017-09-07 17:39:27 +00:00 committed by Android (Google) Code Review
commit e1b1788b4d

View file

@ -464,8 +464,9 @@ void BluetoothHidlTest::sendAndCheckACL(int num_packets, size_t size,
// Return the number of completed packets reported by the controller. // Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) { int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived) if (!bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout) {
.no_timeout); ALOGW("%s: WaitForCallback timed out.", __func__);
}
int packets_processed = 0; int packets_processed = 0;
while (event_queue.size() > 0) { while (event_queue.size() > 0) {
hidl_vec<uint8_t> event = event_queue.front(); hidl_vec<uint8_t> event = event_queue.front();
@ -604,20 +605,24 @@ TEST_F(BluetoothHidlTest, LoopbackModeSinglePackets) {
// This should work, but breaks on some current platforms. Figure out how to // This should work, but breaks on some current platforms. Figure out how to
// grandfather older devices but test new ones. // grandfather older devices but test new ones.
int sco_packets_sent = 0;
if (0 && sco_connection_handles.size() > 0) { if (0 && sco_connection_handles.size() > 0) {
sendAndCheckSCO(1, max_sco_data_packet_length, sco_connection_handles[0]); sendAndCheckSCO(1, max_sco_data_packet_length, sco_connection_handles[0]);
sco_packets_sent = 1; int sco_packets_sent = 1;
EXPECT_EQ(sco_packets_sent, int completed_packets = wait_for_completed_packets_event(sco_connection_handles[0]);
wait_for_completed_packets_event(sco_connection_handles[0])); if (sco_packets_sent != completed_packets) {
ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, sco_packets_sent,
completed_packets);
}
} }
int acl_packets_sent = 0;
if (acl_connection_handles.size() > 0) { if (acl_connection_handles.size() > 0) {
sendAndCheckACL(1, max_acl_data_packet_length, acl_connection_handles[0]); sendAndCheckACL(1, max_acl_data_packet_length, acl_connection_handles[0]);
acl_packets_sent = 1; int acl_packets_sent = 1;
EXPECT_EQ(acl_packets_sent, int completed_packets = wait_for_completed_packets_event(acl_connection_handles[0]);
wait_for_completed_packets_event(acl_connection_handles[0])); if (acl_packets_sent != completed_packets) {
ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, acl_packets_sent,
completed_packets);
}
} }
} }
@ -633,22 +638,26 @@ TEST_F(BluetoothHidlTest, LoopbackModeBandwidth) {
// This should work, but breaks on some current platforms. Figure out how to // This should work, but breaks on some current platforms. Figure out how to
// grandfather older devices but test new ones. // grandfather older devices but test new ones.
int sco_packets_sent = 0;
if (0 && sco_connection_handles.size() > 0) { if (0 && sco_connection_handles.size() > 0) {
sendAndCheckSCO(NUM_SCO_PACKETS_BANDWIDTH, max_sco_data_packet_length, sendAndCheckSCO(NUM_SCO_PACKETS_BANDWIDTH, max_sco_data_packet_length,
sco_connection_handles[0]); sco_connection_handles[0]);
sco_packets_sent = NUM_SCO_PACKETS_BANDWIDTH; int sco_packets_sent = NUM_SCO_PACKETS_BANDWIDTH;
EXPECT_EQ(sco_packets_sent, int completed_packets = wait_for_completed_packets_event(sco_connection_handles[0]);
wait_for_completed_packets_event(sco_connection_handles[0])); if (sco_packets_sent != completed_packets) {
ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, sco_packets_sent,
completed_packets);
}
} }
int acl_packets_sent = 0;
if (acl_connection_handles.size() > 0) { if (acl_connection_handles.size() > 0) {
sendAndCheckACL(NUM_ACL_PACKETS_BANDWIDTH, max_acl_data_packet_length, sendAndCheckACL(NUM_ACL_PACKETS_BANDWIDTH, max_acl_data_packet_length,
acl_connection_handles[0]); acl_connection_handles[0]);
acl_packets_sent = NUM_ACL_PACKETS_BANDWIDTH; int acl_packets_sent = NUM_ACL_PACKETS_BANDWIDTH;
EXPECT_EQ(acl_packets_sent, int completed_packets = wait_for_completed_packets_event(acl_connection_handles[0]);
wait_for_completed_packets_event(acl_connection_handles[0])); if (acl_packets_sent != completed_packets) {
ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__, acl_packets_sent,
completed_packets);
}
} }
} }