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 import logging, os, re, time | 5 import logging, os, re, time |
6 from autotest_lib.client.bin import utils | 6 from autotest_lib.client.bin import utils |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 from autotest_lib.client.cros import login, ui_test | 8 from autotest_lib.client.cros import cros_ui_test, login |
9 | 9 |
10 class desktopui_ChromeFirstRender(ui_test.UITest): | 10 class desktopui_ChromeFirstRender(cros_ui_test.UITest): |
11 version = 1 | 11 version = 1 |
12 | 12 |
13 | 13 |
14 _LOGIN_SUCCESS_FILE = '/tmp/uptime-login-success' | 14 _LOGIN_SUCCESS_FILE = '/tmp/uptime-login-success' |
15 _FIRST_RENDER_FILE = '/tmp/uptime-chrome-first-render' | 15 _FIRST_RENDER_FILE = '/tmp/uptime-chrome-first-render' |
16 | 16 |
17 def __parse_uptime(self, target_file): | 17 def __parse_uptime(self, target_file): |
18 data = file(target_file).read() | 18 data = file(target_file).read() |
19 time = re.split(r' +', data.strip())[0] | 19 time = re.split(r' +', data.strip())[0] |
20 return float(time) | 20 return float(time) |
(...skipping 19 matching lines...) Expand all Loading... |
40 login.TimeoutError('Timeout waiting for initial render'), | 40 login.TimeoutError('Timeout waiting for initial render'), |
41 timeout=60) | 41 timeout=60) |
42 | 42 |
43 start_time = self.__parse_uptime(self._LOGIN_SUCCESS_FILE) | 43 start_time = self.__parse_uptime(self._LOGIN_SUCCESS_FILE) |
44 end_time = self.__parse_uptime(self._FIRST_RENDER_FILE) | 44 end_time = self.__parse_uptime(self._FIRST_RENDER_FILE) |
45 self.write_perf_keyval( | 45 self.write_perf_keyval( |
46 { 'seconds_chrome_first_tab': end_time - start_time }) | 46 { 'seconds_chrome_first_tab': end_time - start_time }) |
47 except IOError, e: | 47 except IOError, e: |
48 logging.debug(e) | 48 logging.debug(e) |
49 raise error.TestFail('Login information missing') | 49 raise error.TestFail('Login information missing') |
OLD | NEW |