1# copyright (c) 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 5import logging, threading 6 7from autotest_lib.server import test 8from autotest_lib.client.common_lib import error 9 10_CHROME_PATH = '/opt/google/chrome/chrome' 11_LONG_TIMEOUT = 120 12_DO_NOT_RUN_ON_TYPE = ['CHROMEBOX', 'CHROMEBIT', 'OTHER'] 13_DO_NOT_RUN_ON_BOARD = ['monroe'] 14 15class platform_InternalDisplay(test.test): 16 version = 1 17 18 def run_suspend(self): 19 """Suspend i.e. powerd_dbus_suspend and wait 20 21 @returns boot_id for the following resume 22 23 """ 24 boot_id = self.host.get_boot_id() 25 thread = threading.Thread(target = self.host.suspend) 26 thread.start() 27 self.host.test_wait_for_sleep(_LONG_TIMEOUT) 28 return boot_id 29 30 def run_once(self,host): 31 32 self.host = host 33 34 board_type = self.host.get_board_type() 35 if board_type in _DO_NOT_RUN_ON_TYPE: 36 raise error.TestNAError('DUT is %s type. Test Skipped' %board_type) 37 38 board = self.host.get_board().split(':')[-1] 39 logging.info(board) 40 if board in _DO_NOT_RUN_ON_BOARD: 41 raise error.TestNAError( 42 'Monroe does not have internal display. Test Skipped') 43 44 self.host.reboot() 45 if self.host.has_internal_display() is not 'internal_display': 46 raise error.TestFail('Internal display is missing after reboot.') 47 48 boot_id = self.run_suspend() 49 logging.info('DUT suspended') 50 self.host.test_wait_for_resume(boot_id, _LONG_TIMEOUT) 51 logging.info('DUT resumed') 52 if self.host.has_internal_display() is not 'internal_display': 53 raise error.TestFail( 54 'Internal display is missing after suspend & resume.') 55 56