• 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_errors
8from autotest_lib.client.cros.cellular.mbim_compliance \
9        import mbim_test_base
10from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
11        import get_descriptors_sequence
12from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
13        import mbim_open_generic_sequence
14
15
16class cellular_MbimComplianceCM03(mbim_test_base.MbimTestBase):
17    """
18    CM_03 Validation of Function's Behavior for an Unsynchronized MBIM_OPEN_MSG.
19
20    This test validates function's behavior in case of an unsynchronized open
21    operation.
22
23    Reference:
24        [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 38
25        http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
26    """
27    version = 1
28
29    def run_internal(self):
30        """ Run CM_03 test. """
31        # Precondition
32        descriptors = get_descriptors_sequence.GetDescriptorsSequence(
33                self.device_context).run()
34        self.device_context.update_descriptor_cache(descriptors)
35        mbim_open_generic_sequence.MBIMOpenGenericSequence(
36                self.device_context).run()
37
38        # Step 1
39        _, response_message = (
40                mbim_open_generic_sequence.MBIMOpenGenericSequence(
41                        self.device_context).run())
42
43        # Validate function's behaviour for an unsynchronized MBIM_OPEN_MSG.
44        if response_message.message_type == mbim_constants.MBIM_CLOSE_DONE:
45            mbim_errors.log_and_raise(mbim_errors.MBIMComplianceAssertionError,
46                                      'mbim1.0:9.3.1#1')
47