def test_fixed_channel(self):
        self._setup_link_from_cert()

        self.dut.l2cap.RegisterChannel(
            l2cap_facade_pb2.RegisterChannelRequest(channel=2))
        asserts.skip("FIXME: Not working")
        self.dut.l2cap.SendL2capPacket(
            l2cap_facade_pb2.L2capPacket(channel=2, payload=b"123"))

        assertThat(self.cert_channel).emits(L2capMatchers.PartialData(b'123'))
    def test_reject_unknown_command(self):
        """
        L2CAP/COS/CED/BI-01-C
        """
        self._setup_link_from_cert()

        asserts.skip("need to use packet builders")
        invalid_command_packet = b"\x04\x00\x01\x00\xff\x01\x00\x00"
        self.cert_l2cap.get_control_channel().send(invalid_command_packet)

        assertThat(self.cert_channel).emits(L2capMatchers.CommandReject())
    def test_extended_feature_info_response_streaming(self):
        """
        L2CAP/EXF/BV-02-C
        """
        asserts.skip("Streaming not supported")
        self._setup_link_from_cert()
        control_channel = self.cert_l2cap.get_control_channel()

        control_channel.send_extended_features_request()

        assertThat(control_channel).emits(
            L2capMatchers.InformationResponseExtendedFeatures(
                supports_streaming=True))
Beispiel #4
0
 def logic(self, setting, arg, special_arg=None):
     asserts.assert_true(setting in itrs, (
         "%s is not in acceptable settings range %s") %
                         (setting, itrs))
     asserts.assert_true(arg == static_arg,
                         "Expected %s, got %s" % (static_arg, arg))
     asserts.assert_true(arg == static_arg, "Expected %s, got %s" %
                         (static_kwarg, special_arg))
     if setting == "pass":
         asserts.explicit_pass(
             MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
     elif setting == "fail":
         asserts.fail(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
     elif setting == "skip":
         asserts.skip(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
    def test_respond_to_echo_request(self):
        """
        L2CAP/COS/ECH/BV-01-C [Respond to Echo Request]
        Verify that the IUT responds to an echo request.
        """
        self._setup_link_from_cert()
        asserts.skip("is echo without a channel supported?")

        echo_request = l2cap_packets.EchoRequestBuilder(
            100, l2cap_packets.DisconnectionRequestBuilder(1, 2, 3))
        echo_request_l2cap = l2cap_packets.BasicFrameBuilder(1, echo_request)
        self.cert_send_b_frame(echo_request_l2cap)

        assertThat(self.cert_channel).emits(
            L2capMatchers.PartialData(b"\x06\x01\x04\x00\x02\x00\x03\x00"))
    def test_initiated_configuration_request_ertm(self):
        """
        L2CAP/CMC/BV-01-C [IUT Initiated Configuration of Enhanced Retransmission Mode]
        Verify the IUT can send a Configuration Request command containing the F&EC option that specifies
        Enhanced Retransmission Mode.
        """
        self._setup_link_from_cert()
        self.cert_l2cap.turn_on_ertm()

        self._open_unvalidated_channel(scid=0x41, psm=0x33, use_ertm=True)

        # TODO: Fix this test. It doesn't work so far with PDL struct

        assertThat(self.cert_l2cap.get_control_channel()).emits(
            L2capMatchers.ConfigurationRequest())
        asserts.skip("Struct not working")
    def test_s_frame_transmissions_exceed_max_transmit(self):
        """
        L2CAP/ERM/BV-11-C [S-Frame Transmissions Exceed MaxTransmit]
        Verify the IUT will close the channel when the Monitor Timer expires.
        """
        asserts.skip("Need to configure DUT to have a shorter timer")
        self._setup_link_from_cert()
        self.cert_l2cap.turn_on_ertm()

        (dut_channel, cert_channel) = self._open_channel(scid=0x41,
                                                         psm=0x33,
                                                         use_ertm=True)

        dut_channel.send(b'abc')

        # Retransmission timer = 2, 20 * monitor timer = 360, so total timeout is 362
        time.sleep(362)
        assertThat(self.cert_l2cap.get_control_channel()).emits(
            L2capMatchers.DisconnectionRequest())
Beispiel #8
0
 def test_func(self):
     asserts.skip(MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
     never_call()
 def test_skip_a_test(self):
     asserts.skip("Skipping this test because it's blocked by b/xyz")
     assert False