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 test 7 8class DevicePolicyServerTest(test.test): 9 """ 10 A server test that verifies a device policy, by refreshing the TPM so the 11 DUT is not owned, and then kicking off the client test. 12 13 This class takes charge of the TPM initialization and cleanup, but child 14 tests should implement their own run_once(). 15 """ 16 version = 1 17 18 def warmup(self, host, *args, **kwargs): 19 """Clear TPM to ensure that client test can enroll device.""" 20 super(DevicePolicyServerTest, self).warmup(host, *args, **kwargs) 21 self.host = host 22 tpm_utils.ClearTPMIfOwned(self.host) 23 24 def cleanup(self): 25 """Get the DUT back to a clean state.""" 26 tpm_utils.ClearTPMIfOwned(self.host) 27 super(DevicePolicyServerTest, self).cleanup() 28