OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 import logging, re, time | 6 import logging, re, time |
7 from autotest_lib.client.bin import test, utils, site_log_reader | 7 from autotest_lib.client.bin import test, utils |
8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
9 from autotest_lib.client.cros import ui | 9 from autotest_lib.client.cros import log_reader, ui |
10 | 10 |
11 class desktopui_FlashSanityCheck(test.test): | 11 class desktopui_FlashSanityCheck(test.test): |
12 version = 1 | 12 version = 1 |
13 | 13 |
14 | 14 |
15 def run_once(self, time_to_wait=25): | 15 def run_once(self, time_to_wait=25): |
16 # take a snapshot from /var/log/messages. | 16 # take a snapshot from /var/log/messages. |
17 self._log_reader = site_log_reader.LogReader() | 17 self._log_reader = log_reader.LogReader() |
18 self._log_reader.set_start_by_current() | 18 self._log_reader.set_start_by_current() |
19 | 19 |
20 # open browser to youtube.com. | 20 # open browser to youtube.com. |
21 session = ui.ChromeSession('http://www.youtube.com') | 21 session = ui.ChromeSession('http://www.youtube.com') |
22 # wait some time till the webpage got fully loaded. | 22 # wait some time till the webpage got fully loaded. |
23 time.sleep(time_to_wait) | 23 time.sleep(time_to_wait) |
24 session.close() | 24 session.close() |
25 # Question: do we need to test with other popular flash websites? | 25 # Question: do we need to test with other popular flash websites? |
26 | 26 |
27 # any better pattern matching? | 27 # any better pattern matching? |
28 if self._log_reader.can_find(' Received crash notification for '): | 28 if self._log_reader.can_find(' Received crash notification for '): |
29 # well, there is a crash. sample crash message: | 29 # well, there is a crash. sample crash message: |
30 # 2010-10-04T19:13:17.923673-07:00 localhost crash_reporter[30712]: | 30 # 2010-10-04T19:13:17.923673-07:00 localhost crash_reporter[30712]: |
31 # Received crash notification for chrome[29888] sig 11 (ignoring) | 31 # Received crash notification for chrome[29888] sig 11 (ignoring) |
32 raise error.TestFail('Browser crashed during test.\nMessage ' | 32 raise error.TestFail('Browser crashed during test.\nMessage ' |
33 'from /var/log/messages:\n%s' % new_msg) | 33 'from /var/log/messages:\n%s' % new_msg) |
OLD | NEW |