src/connectivity/bluetooth/core/bt-host/l2cap/enhanced_retransmission_mode_engines_unittest.cc
// This tests the integration of receiving an acknowledgment sequence with triggering retransmission
// of unacknowledged I-Frames. This mirrors the L2CAP Test Specification L2CAP/ERM/BV-18-C.
This tests the integration of receiving an acknowledgment sequence with triggering retransmission
of unacknowledged I-Frames. This mirrors the L2CAP Test Specification L2CAP/ERM/BV-18-C.
This tests the integration of receiving an acknowledgment sequence with triggering retransmission of unacknowledged I - Frames . This mirrors the L2CAP Test Specification L2CAP / ERM / BV - 18 - C .
TEST_F(L2CAP_EnhancedRetransmissionModeEnginesTest,
       RetransmitAfterPollResponseDoesNotAcknowledgeSentFrames) {
  DynamicByteBuffer info_frame;
  int tx_count = 0;
  auto tx_callback = [&info_frame, &tx_count](ByteBufferPtr pdu) {
    if (tx_count == 0) {
      info_frame = DynamicByteBuffer(*pdu);
    } else if (tx_count == 2) {
      EXPECT_TRUE(ContainersEqual(info_frame, *pdu));
    }
    tx_count++;
  };
  auto [rx_engine, tx_engine] = MakeLinkedEnhancedRetransmissionModeEngines(
      kTestChannelId, kDefaultMTU, kMaxTransmissions, kTxWindow, tx_callback, NoOpFailureCallback);
  ASSERT_TRUE(rx_engine);
  ASSERT_TRUE(tx_engine);
  tx_engine->QueueSdu(std::make_unique<DynamicByteBuffer>(StaticByteBuffer{'a'}));
  EXPECT_EQ(1, tx_count);
  ASSERT_TRUE(RunLoopFor(kErtmReceiverReadyPollTimerDuration));
  EXPECT_EQ(2, tx_count);
  auto receiver_ready = StaticByteBuffer(0b1 | kExtendedControlFBitMask, 0);
  rx_engine->ProcessPdu(
      Fragmenter(kTestHandle)
          .BuildFrame(kTestChannelId, receiver_ready, FrameCheckSequenceOption::kIncludeFcs));
  EXPECT_EQ(3, tx_count);
}
TEST_F ( L2CAP_EnhancedRetransmissionModeEnginesTest , RetransmitAfterPollResponseDoesNotAcknowledgeSentFrames ) { DynamicByteBuffer info_frame ; int tx_count = 0 ; auto tx_callback = [ & info_frame , & tx_count ] ( ByteBufferPtr pdu ) { if ( tx_count == 0 ) { info_frame = DynamicByteBuffer ( * pdu ) ; } else if ( tx_count == 2 ) { EXPECT_TRUE ( ContainersEqual ( info_frame , * pdu ) ) ; } tx_count ++ ; } ; auto [ rx_engine , tx_engine ] = MakeLinkedEnhancedRetransmissionModeEngines ( kTestChannelId , kDefaultMTU , kMaxTransmissions , kTxWindow , tx_callback , NoOpFailureCallback ) ; ASSERT_TRUE ( rx_engine ) ; ASSERT_TRUE ( tx_engine ) ; tx_engine -> QueueSdu ( std :: make_unique < DynamicByteBuffer > ( StaticByteBuffer { ' ' } ) ) ; EXPECT_EQ ( 1 , tx_count ) ; ASSERT_TRUE ( RunLoopFor ( kErtmReceiverReadyPollTimerDuration ) ) ; EXPECT_EQ ( 2 , tx_count ) ; auto receiver_ready = StaticByteBuffer ( 0b1 | kExtendedControlFBitMask , 0 ) ; rx_engine -> ProcessPdu ( Fragmenter ( kTestHandle ) . BuildFrame ( kTestChannelId , receiver_ready , FrameCheckSequenceOption :: kIncludeFcs ) ) ; EXPECT_EQ ( 3 , tx_count ) ; }
This tests the integration of receiving an acknowledgment sequence with triggering retransmission
of unacknowledged I-Frames.
This tests the integration of receiving an acknowledgment sequence with triggering retransmission of unacknowledged I - Frames .
// The first packet is the I-Frame containing the data that we sent. // The second packet is the S-Frame polling for the peer after the Retransmission Timer expires. // It is not checked to keep the tests less fragile, as the first two packets are already // covered by L2CAP_EnhancedRetransmissionModeTxEngineTest. // Receive an S-frame containing an acknowledgment not including the frame that we transmitted. F // is set. See Core Spec, v5, Vol 3, Part A, Section 3.3.2, S-Frame Enhanced Control Field. // Check that this caused a retransmission of the initial I-Frame.