1 # Copyright 2014 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import common 6 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_constants 7 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors 8 from autotest_lib.client.cros.cellular.mbim_compliance import mbim_test_base 9 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \ 10 import connect_sequence 11 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \ 12 import get_descriptors_sequence 13 from autotest_lib.client.cros.cellular.mbim_compliance.sequences \ 14 import mbim_open_generic_sequence 15 16 17 class cellular_MbimComplianceERR04(mbim_test_base.MbimTestBase): 18 """ 19 Validation of discarding packets in case of an error. 20 21 This test verifies that in case of an error message with status code 22 MBIM_ERROR_FRAGMENT_OUT_OF_SEQUENCE all packets of the message caused the 23 error are discarded by the function. 24 25 Reference: 26 [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 46 27 http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf 28 29 """ 30 version = 1 31 32 def run_internal(self): 33 """ Run ERR_04 test. """ 34 # Precondition 35 descriptors = get_descriptors_sequence.GetDescriptorsSequence( 36 self.device_context).run() 37 self.device_context.update_descriptor_cache(descriptors) 38 open_sequence = mbim_open_generic_sequence.MBIMOpenGenericSequence( 39 self.device_context) 40 open_sequence.run(max_control_transfer_size=64) 41 42 # Step 1 43 request_message, response_message, _ = ( 44 connect_sequence.ConnectSequence(self.device_context).run( 45 introduce_error_in_packets_order=[1, 0, 2], 46 raise_exception_on_failure=False)) 47 48 # Step 2 49 if ((response_message.transaction_id != 50 request_message.transaction_id) or 51 (response_message.message_type == 52 mbim_constants.MBIM_COMMAND_DONE)): 53 mbim_errors.log_and_raise(mbim_errors.MBIMComplianceAssertionError, 54 'mbim1.0:9.3.4.2#3') 55