1# Copyright 2018 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 5import time 6 7from autotest_lib.client.cros.power import power_dashboard 8from autotest_lib.client.cros.power import power_test 9 10class power_Dummy(power_test.power_Test): 11 """class for testing power wrapper tests. 12 13 Run for a short time and collect logger data. 14 """ 15 version = 1 16 loop = 3 17 loop_time = 3.0 18 dummy_result = 0 19 20 def initialize(self, pdash_note=''): 21 """Measure power with a short interval.""" 22 super(power_Dummy, self).initialize(seconds_period=1., 23 pdash_note=pdash_note) 24 25 def warmup(self): 26 """Warm up for a short time.""" 27 super(power_Dummy, self).warmup(warmup_time=1.) 28 29 def run_once(self): 30 """Measure power with multiple loggers.""" 31 start_ts = time.time() 32 self.start_measurements() 33 for i in range(self.loop): 34 tstart = time.time() 35 time.sleep(self.loop_time) 36 self.checkpoint_measurements('section%s' % i, tstart) 37 38 pdash = power_dashboard.SimplePowerLoggerDashboard( 39 self.loop * self.loop_time, self.dummy_result, 40 self.tagged_testname, start_ts, self.resultsdir, 41 note=self._pdash_note) 42 pdash.upload() 43 44