• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5import common
6from autotest_lib.client.cros.cellular.mbim_compliance import mbim_constants
7from autotest_lib.client.cros.cellular.mbim_compliance import mbim_dts_test_base
8from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
9from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
10        import loopback_sequence
11
12
13class cellular_MbimComplianceDTS0612(mbim_dts_test_base.MbimDtsTestBase):
14    """
15    Validation of wBlockLength.
16
17    This test validates the value in wBlockLength field of NTH16/NTH32.
18
19    Reference:
20        [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 28
21        http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
22
23    """
24    version = 1
25
26    def run_internal(self, ntb_format):
27        """
28        Run DTS_06/DTS_12 test.
29
30        @param ntb_format: Whether to send/receive an NTB16 or NTB32 frame.
31                Possible values: NTB_FORMAT_16, NTB_FORMAT_32 (mbim_constants)
32
33        """
34        # Precondition
35        _, _, _ = self.run_precondition(ntb_format)
36
37        # Step 1
38        loopback = loopback_sequence.LoopbackSequence(self.device_context)
39        nth, _, _, _ = loopback.run(ntb_format=ntb_format)
40
41        # Step 2
42        if ntb_format == mbim_constants.NTB_FORMAT_16:
43            if nth.block_length > self.device_context.max_in_data_transfer_size:
44                mbim_errors.log_and_raise(
45                        mbim_errors.MBIMComplianceAssertionError,
46                        'ncm1.0:3.2.1#5')
47        else:
48            if nth.block_length > self.device_context.max_in_data_transfer_size:
49                mbim_errors.log_and_raise(
50                        mbim_errors.MBIMComplianceAssertionError,
51                        'ncm1.0:3.2.2#5')
52