Home | History | Annotate | Download | only in graphics_PowerConsumption
      1 # Copyright 2017 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 import logging
      5 from autotest_lib.server import autotest
      6 from autotest_lib.server import test
      7 from autotest_lib.client.common_lib import error
      8 
      9 
     10 class graphics_PowerConsumption(test.test):
     11     version = 1
     12 
     13     def run_once(self, host, client_test):
     14         """Runs client test with battery actively discharging."""
     15         if not host.has_power():
     16             raise error.TestError("This test requires RPM support.")
     17 
     18         try:
     19             logging.debug("Powering off client machine before running %s test.",
     20                           client_test)
     21             host.power_off()
     22             client = autotest.Autotest(host)
     23             client.run_test(client_test, power_test=True)
     24         finally:
     25             host.power_on()
     26