1# Copyright 2015 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.common_lib import error 6from autotest_lib.server.cros import dark_resume_utils 7from autotest_lib.server.cros.network import wifi_cell_test_base 8 9class LucidSleepTestBase(wifi_cell_test_base.WiFiCellTestBase): 10 """An abstract base class for Lucid Sleep autotests in WiFi cells. 11 12 Lucid Sleep tests are WiFi cell tests that perform wake-on-WiFi-related 13 setup and cleanup routines. 14 """ 15 16 @property 17 def dr_utils(self): 18 """@return the dark resume utilities for this test.""" 19 return self._dr_utils 20 21 22 def initialize(self, host): 23 super(LucidSleepTestBase, self).initialize(host) 24 self._dr_utils = dark_resume_utils.DarkResumeUtils(host) 25 26 27 def warmup(self, host, raw_cmdline_args, additional_params=None): 28 super(LucidSleepTestBase, self).warmup( 29 host, raw_cmdline_args, additional_params) 30 if (self.context.client.is_wake_on_wifi_supported() is False): 31 raise error.TestNAError('Wake on WiFi is not supported by this DUT') 32 33 34 def cleanup(self): 35 self._dr_utils.teardown() 36 super(LucidSleepTestBase, self).cleanup() 37