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

Commit cba3e5f5 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "L2CAP: Add test for L2CAP 2/7 Support of command information response" am: c69816f6

Change-Id: I42ae0b7503a6eb7273e496ed357a6d5a6f6eaf8a
parents fe887620 c69816f6
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -752,11 +752,12 @@ class L2capTest(GdFacadeOnlyBaseTestClass):
                self.cert_device.hci_acl_manager.FetchAclData(
                    empty_proto.Empty())) as cert_acl_data_stream:
            cert_acl_data_asserts = EventAsserts(cert_acl_data_stream)
            cert_acl_data_asserts_alt = EventAsserts(cert_acl_data_stream)
            cert_acl_data_stream.register_callback(self._handle_control_packet)
            signal_id = 3
            information_request = l2cap_packets.InformationRequestBuilder(
                signal_id, l2cap_packets.InformationRequestInfoType.
                FIXED_CHANNELS_SUPPORTED)
                EXTENDED_FEATURES_SUPPORTED)
            information_request_l2cap = l2cap_packets.BasicFrameBuilder(
                1, information_request)
            self.cert_send_b_frame(information_request_l2cap)
@@ -775,11 +776,30 @@ class L2capTest(GdFacadeOnlyBaseTestClass):
                information_response_view = l2cap_packets.InformationResponseView(
                    l2cap_control_view)
                return information_response_view.GetInfoType(
                ) == l2cap_packets.InformationRequestInfoType.FIXED_CHANNELS_SUPPORTED
                ) == l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED

            cert_acl_data_asserts.assert_event_occurs(
                is_correct_information_response)

            def is_correct_information_request(l2cap_packet):
                packet_bytes = l2cap_packet.payload
                l2cap_view = l2cap_packets.BasicFrameView(
                    bt_packets.PacketViewLittleEndian(list(packet_bytes)))
                if l2cap_view.GetChannelId() != 1:
                    return False
                l2cap_control_view = l2cap_packets.ControlView(
                    l2cap_view.GetPayload())
                if l2cap_control_view.GetCode(
                ) != l2cap_packets.CommandCode.INFORMATION_REQUEST:
                    return False
                information_request_view = l2cap_packets.InformationRequestView(
                    l2cap_control_view)
                return information_request_view.GetInfoType(
                ) == l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED

            cert_acl_data_asserts_alt.assert_event_occurs(
                is_correct_information_request)

    def test_extended_feature_info_response_ertm(self):
        """
        L2CAP/EXF/BV-01-C [Extended Features Information Response for Enhanced
+25 −6
Original line number Diff line number Diff line
@@ -76,6 +76,31 @@ class PTSL2capTest(PTSBaseTestClass):
            lambda device: device.remote.address == self.pts_address.address,
            timeout=timedelta(seconds=timeout))

    def test_L2CAP_IEX_BV_01_C(self):
        """
        L2CAP/COS/IEX/BV-01-C [Query for 1.2 Features]
        Verify that the IUT transmits an information request command to solicit if the remote device supports
        Specification 1.2 features.
        """
        psm = 1
        self.device_under_test.l2cap.OpenChannel(
            l2cap_facade_pb2.OpenChannelRequest(
                remote=self.pts_address, psm=psm))
        time.sleep(5)

    def test_L2CAP_IEX_BV_02_C(self):
        """
        L2CAP/COS/IEX/BV-02-C [Respond with 1.2 Features]
        Verify that the IUT responds to an information request command soliciting for Specification 1.2
        features.
        """
        psm = 1
        retransmission_mode = l2cap_facade_pb2.RetransmissionFlowControlMode.ERTM
        self.device_under_test.l2cap.SetDynamicChannel(
            l2cap_facade_pb2.SetEnableDynamicChannelRequest(
                psm=psm, retransmission_mode=retransmission_mode))
        time.sleep(20)

    def test_L2CAP_EXF_BV_01_C(self):
        """
        L2CAP/EXF/BV-01-C [Extended Features Information Response for Enhanced Retransmission Mode]
@@ -83,9 +108,6 @@ class PTSL2capTest(PTSBaseTestClass):
        correctly identifies that Enhanced Retransmission Mode is locally supported.

        """
        with self._dut_connection_close_stream() as dut_connection_close_stream:
            due_connection_close_asserts = EventAsserts(
                dut_connection_close_stream)
        psm = 1
        retransmission_mode = l2cap_facade_pb2.RetransmissionFlowControlMode.ERTM
        self.device_under_test.l2cap.SetDynamicChannel(
@@ -99,9 +121,6 @@ class PTSL2capTest(PTSBaseTestClass):
        Verify the IUT can format an Information Response for the information type of Extended Features that
        correctly identifies that the FCS Option is locally supported.
        """
        with self._dut_connection_close_stream() as dut_connection_close_stream:
            due_connection_close_asserts = EventAsserts(
                dut_connection_close_stream)
        psm = 1
        retransmission_mode = l2cap_facade_pb2.RetransmissionFlowControlMode.ERTM
        self.device_under_test.l2cap.SetDynamicChannel(