1# Copyright (c) 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"""
6CM_03 Validation of Function's Behavior for an Unsynchronized MBIM_OPEN_MSG.
7
8Reference:
9    [1] Universal Serial Bus Communication Class MBIM Compliance Testing: 38
10        http://www.usb.org/developers/docs/devclass_docs/MBIM-Compliance-1.0.pdf
11"""
12
13import common
14from autotest_lib.client.cros.cellular.mbim_compliance import mbim_constants
15from autotest_lib.client.cros.cellular.mbim_compliance import mbim_errors
16from autotest_lib.client.cros.cellular.mbim_compliance.sequences \
17        import mbim_open_generic_sequence
18from autotest_lib.client.cros.cellular.mbim_compliance.tests import test
19
20
21class CM03Test(test.Test):
22    """ Implement the CM_03 test. """
23
24    def run_internal(self):
25        """ Run CM_03 test. """
26        # Precondition
27        _, _ = mbim_open_generic_sequence.MBIMOpenGenericSequence(
28                self.test_context).run()
29        # Step 1
30        open_message, response_message = (
31                mbim_open_generic_sequence.MBIMOpenGenericSequence(
32                        self.test_context).run())
33
34        # Validate function's behaviour for an unsynchronized MBIM_OPEN_MSG.
35        if response_message.message_type == mbim_constants.MBIM_CLOSE_DONE:
36            mbim_errors.log_and_raise(mbim_errors.MBIMComplianceAssertionError,
37                                      'mbim1.0:9.3.1#1')
38