xref: /aosp_15_r20/external/autotest/client/site_tests/power_CheckAC/power_CheckAC.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Lint as: python2, python3
2# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from autotest_lib.client.bin import test
7from autotest_lib.client.common_lib import error, utils
8from autotest_lib.client.cros.power import power_status
9
10class power_CheckAC(test.test):
11    """Check the line status for AC power
12
13    This is meant for verifying system setups in the lab to make sure that the
14    AC line status can be remotely turned on and off.
15    """
16    version = 1
17
18
19    def run_once(self, power_on=True):
20        utils.poll_for_condition(
21            lambda: power_status.get_status().on_ac() == power_on,
22            timeout=10, exception=error.TestError('AC power not %d' % power_on))
23