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

Commit 3fd3a9f0 authored by Chris Manton's avatar Chris Manton
Browse files

gd: pts test L2CAP/COS/CFD/BV-02-C

Bug: 150638104
Test: ./gd/cert/run --host --test_filter=L2capTest
Change-Id: I9a15523474885ae2f1f7d1a77301613b5a4b8a9e
parent caf06134
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -552,6 +552,44 @@ class L2capTest(GdFacadeOnlyBaseTestClass):

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_extended_feature_info_response_streaming(self):
        """
        L2CAP/EXF/BV-02-C
        """
        asserts.skip("Streaming not supported")
        self._setup_link_from_cert()

        signal_id = 3
        information_request = l2cap_packets.InformationRequestBuilder(
            signal_id,
            l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED
        )
        information_request_l2cap = l2cap_packets.BasicFrameBuilder(
            1, information_request)
        self.cert_send_b_frame(information_request_l2cap)

        def is_correct_information_response(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_RESPONSE:
                return False
            information_response_view = l2cap_packets.InformationResponseView(
                l2cap_control_view)
            if information_response_view.GetInfoType(
            ) != l2cap_packets.InformationRequestInfoType.EXTENDED_FEATURES_SUPPORTED:
                return False
            extended_features_view = l2cap_packets.InformationResponseExtendedFeaturesView(
                information_response_view)
            return extended_features_view.GetStreamingMode()

        assertThat(self.cert_acl).emits(is_correct_information_response)

    def test_extended_feature_info_response_fcs(self):
        """
        L2CAP/EXF/BV-03-C [Extended Features Information Response for FCS Option]
+2 −1
Original line number Diff line number Diff line
@@ -509,7 +509,8 @@ void ClassicSignallingManager::OnInformationRequest(SignalId signal_id, Informat
    case InformationRequestInfoType::EXTENDED_FEATURES_SUPPORTED: {
      // TODO: implement this response
      auto response = InformationResponseExtendedFeaturesBuilder::Create(
          signal_id.Value(), InformationRequestResult::SUCCESS, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0);
          signal_id.Value(), InformationRequestResult::SUCCESS, 0, 0, 0, 1 /* ERTM */, 0 /* Streaming mode */,
          1 /* FCS */, 0, 0 /* Fixed Channels */, 0, 0);
      enqueue_buffer_->Enqueue(std::move(response), handler_);
      break;
    }