1 # Copyright 2014 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 5 from autotest_lib.client.bin import test, utils 6 from autotest_lib.client.common_lib import error 7 8 9 class desktopui_AppShellFlashstation(test.test): 10 """ 11 Checks that app_shell is up and that the flashstation app logged a message. 12 """ 13 14 version = 1 15 16 # Name of the app_shell binary. 17 _APP_SHELL_EXECUTABLE = 'app_shell' 18 19 # Regular expression matching a message logged by the app via console.log() 20 # after it starts. 21 _STARTUP_MESSAGE = 'Flashstation UI is ready' 22 23 # File where the current app_shell instance logs the app's output. 24 _LOG_FILE = '/var/log/ui/ui.LATEST' 25 26 def run_once(self): 27 """Runs the test.""" 28 29 if not utils.get_oldest_pid_by_name(self._APP_SHELL_EXECUTABLE): 30 raise error.TestFail('Didn\'t find a process named "%s"' % 31 self._APP_SHELL_EXECUTABLE) 32 33 if not utils.grep(self._STARTUP_MESSAGE, self._LOG_FILE): 34 raise error.TestFail('"%s" isn\'t present in %s' % 35 (self._STARTUP_MESSAGE, self._LOG_FILE)) 36