• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 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.cros import tpm_utils
6from autotest_lib.server import autotest
7from autotest_lib.server import test
8
9
10class policy_WilcoServerOnNonWilcoDevice(test.test):
11    """
12    policy_DeviceServer test used to kick off any arbitrary client test.
13
14    """
15    version = 1
16
17
18    def cleanup(self):
19        """Cleanup for this test."""
20        tpm_utils.ClearTPMIfOwned(self.host)
21        self.host.reboot()
22
23
24    def run_once(self, client_test, host, case=None):
25        """
26        Starting point of this test.
27
28        Note: base class sets host as self._host.
29
30        @param client_test: the name of the Client test to run.
31        @param case: the case to run for the given Client test.
32
33        """
34        # Policies to loop through in the client test.
35        tests = [{'Policy_Name': 'DeviceBootOnAcEnabled',
36                    'Policy_Value': True},
37                 {'Policy_Name': 'DevicePowerPeakShiftEnabled',
38                    'Policy_Value': True},
39                 {'Policy_Name': 'DeviceDockMacAddressSource',
40                     'Policy_Value': 1},
41                 {'Policy_Name': 'DeviceUsbPowerShareEnabled',
42                     'Policy_Value': True},
43                 {'Policy_Name': 'DeviceAdvancedBatteryChargeModeEnabled',
44                     'Policy_Value': True},
45                 {'Policy_Name': 'DeviceBatteryChargeMode',
46                     'Policy_Value': 1},
47                ]
48
49        self.host = host
50        # Clear TPM to ensure that client test can enroll device.
51        tpm_utils.ClearTPMIfOwned(self.host)
52
53        self.autotest_client = autotest.Autotest(self.host)
54        self.autotest_client.run_test(
55            client_test, tests=tests, check_client_result=True)
56