• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 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
5from autotest_lib.client.common_lib import error
6from autotest_lib.server.cros.faft.cr50_test import Cr50Test
7
8
9class firmware_Cr50DevMode(Cr50Test):
10    """Verify cr50 can tell the state of the dev mode switch."""
11    version = 1
12
13
14    def check_dev_mode(self, dev_mode):
15        """Verify the cr50 tpm info matches the devmode state."""
16        if self.cr50.in_dev_mode() != dev_mode:
17            raise error.TestFail('Cr50 should%s think dev mode is active' %
18                    ('' if dev_mode else "n't"))
19
20
21    def run_once(self):
22        """Check cr50 can see dev mode correctly."""
23        self.enter_mode_after_checking_cr50_state('normal')
24        self.check_dev_mode(False)
25        self.enter_mode_after_checking_cr50_state('dev')
26        self.check_dev_mode(True)
27        self.enter_mode_after_checking_cr50_state('normal')
28        self.check_dev_mode(False)
29