1# Copyright (c) 2012 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.bin import test 8from autotest_lib.client.common_lib.cros import chrome 9from autotest_lib.client.cros import power_suspend, sys_power 10 11 12class power_UiResume(test.test): 13 """ 14 Suspend a logged in system by sending a request to power manager via dbus. 15 16 This test waits quite a bit after logging in and before suspending. 17 Therefore it verifies suspend/resume functionality for an idle system. For 18 stress-testing suspend/resume in parallel with other things going on, see 19 power_SuspendStress. 20 21 """ 22 version = 2 23 24 def initialize(self): 25 self._suspender = power_suspend.Suspender(self.resultsdir, 26 method=sys_power.do_suspend, throw=True) 27 28 29 def run_once(self): 30 # Some idle time before initiating suspend-to-ram 31 with chrome.Chrome(): 32 time.sleep(10) 33 results = self._suspender.suspend(0) 34 self.write_perf_keyval(results) 35