Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14347f45 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

L2capTest: Add Send Reject Test am: c69c11ef

Change-Id: Ic332941ed7bc8e8e2dec65bb11e43a56e6106703
parents af6f9d61 c69c11ef
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -920,6 +920,43 @@ class L2capTest(GdBaseTestClass):
        assertThat(cert_channel).emits(
            L2capMatchers.IFrame(tx_seq=3, payload=b'abc', f=Final.NOT_SET))

    @metadata(
        pts_test_id="L2CAP/ERM/BV-16-C", pts_test_name="Send S-Frame [REJ]")
    def test_send_s_frame_rej(self):
        """
        Verify the IUT can send an S-Frame [REJ] after receiving out of sequence
        I-Frames
        """
        self._setup_link_from_cert()
        tx_window_size = 4
        self.cert_l2cap.turn_on_ertm(
            tx_window_size=tx_window_size, max_transmit=2)

        (dut_channel, cert_channel) = self._open_channel(
            scid=0x41, psm=0x33, mode=RetransmissionFlowControlMode.ERTM)

        cert_channel.send_i_frame(
            tx_seq=0, req_seq=0, f=Final.NOT_SET, payload=SAMPLE_PACKET)
        cert_channel.send_i_frame(
            tx_seq=2, req_seq=0, f=Final.NOT_SET, payload=SAMPLE_PACKET)

        assertThat(cert_channel).emits(
            L2capMatchers.SFrame(
                req_seq=1,
                f=Final.NOT_SET,
                s=SupervisoryFunction.REJECT,
                p=Poll.NOT_SET))

        for i in range(1, tx_window_size):
            cert_channel.send_i_frame(
                tx_seq=i, req_seq=0, f=Final.NOT_SET, payload=SAMPLE_PACKET)
        assertThat(cert_channel).emits(
            L2capMatchers.SFrame(
                req_seq=tx_window_size,
                f=Final.NOT_SET,
                s=SupervisoryFunction.RECEIVER_READY,
                p=Poll.NOT_SET))

    @metadata(
        pts_test_id="L2CAP/ERM/BV-18-C",
        pts_test_name="Receive S-Frame [RR] Final Bit = 1")