Home | History | Annotate | Download | only in power_CheckAC
      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 
      5 from autotest_lib.client.bin import test
      6 from autotest_lib.client.common_lib import error
      7 from autotest_lib.client.cros import power_status
      8 
      9 class 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         status = power_status.get_status()
     20         if power_on and not status.on_ac():
     21             raise error.TestError('AC line status is not on but should be')
     22         elif not power_on and status.on_ac():
     23             raise error.TestError('AC line status is on but should not be')
     24