Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: client/site_tests/desktopui_ChromeFirstRender/desktopui_ChromeFirstRender.py

Issue 1363002: Add session object so that we have one class that control logged in session (Closed)
Patch Set: Fix comments Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, re 5 import logging, re, time
6 from autotest_lib.client.bin import test 6 from autotest_lib.client.bin import site_ui_test
7 from autotest_lib.client.common_lib import error 7 from autotest_lib.client.common_lib import error
8 8
9 class desktopui_ChromeFirstRender(test.test): 9 class desktopui_ChromeFirstRender(site_ui_test.UITest):
10 version = 1 10 version = 1
11 11
12
12 def __parse_uptime(self, target_file): 13 def __parse_uptime(self, target_file):
13 data = file(target_file).read() 14 data = file(target_file).read()
14 time = re.split(r' +', data.strip())[0] 15 time = re.split(r' +', data.strip())[0]
15 return float(time) 16 return float(time)
16 17
17 18
18 def run_once(self): 19 def run_once(self):
19 try: 20 try:
21 time.sleep(10) # Wait for chrome to render.
20 start_time = self.__parse_uptime('/tmp/uptime-login-successful') 22 start_time = self.__parse_uptime('/tmp/uptime-login-successful')
21 end_time = self.__parse_uptime('/tmp/uptime-chrome-first-render') 23 end_time = self.__parse_uptime('/tmp/uptime-chrome-first-render')
22 self.write_perf_keyval({'seconds_chrome_first_tab': 24 self.write_perf_keyval({'seconds_chrome_first_tab':
23 end_time - start_time}) 25 end_time - start_time})
24 except IOError, e: 26 except IOError, e:
25 logging.debug(e) 27 logging.debug(e)
26 raise error.TestFail('Login information missing') 28 raise error.TestFail('Login information missing')
27 29
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698