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
5from autotest_lib.client.bin import test
6from autotest_lib.client.common_lib import error, utils
7from autotest_lib.client.cros.power import power_status
8
9class power_CheckAC(test.test):
10    """Check the line status for AC power
11
12    This is meant for verifying system setups in the lab to make sure that the
13    AC line status can be remotely turned on and off.
14    """
15    version = 1
16
17
18    def run_once(self, power_on=True):
19        utils.poll_for_condition(
20            lambda: power_status.get_status().on_ac() == power_on,
21            timeout=10, exception=error.TestError('AC power not %d' % power_on))
22