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

Side by Side Diff: tools/telemetry/examples/rendering_microbenchmark_test.py

Issue 11361165: [chrome_remote_control] Rename chrome_remote_control to telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 import os 5 import os
6 import re 6 import re
7 import sys 7 import sys
8 8
9 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 9 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
10 10
11 import chrome_remote_control 11 import telemetry
12 12
13 def Main(args): 13 def Main(args):
14 options = chrome_remote_control.BrowserOptions() 14 options = telemetry.BrowserOptions()
15 parser = options.CreateParser('rendering_microbenchmark_test.py <sitelist>') 15 parser = options.CreateParser('rendering_microbenchmark_test.py <sitelist>')
16 # TODO(nduca): Add test specific options here, if any. 16 # TODO(nduca): Add test specific options here, if any.
17 options, args = parser.parse_args(args) 17 options, args = parser.parse_args(args)
18 if len(args) != 1: 18 if len(args) != 1:
19 parser.print_usage() 19 parser.print_usage()
20 return 255 20 return 255
21 21
22 urls = [] 22 urls = []
23 with open(args[0], 'r') as f: 23 with open(args[0], 'r') as f:
24 for url in f.readlines(): 24 for url in f.readlines():
25 url = url.strip() 25 url = url.strip()
26 if not re.match('(.+)://', url): 26 if not re.match('(.+)://', url):
27 url = 'http://%s' % url 27 url = 'http://%s' % url
28 urls.append(url) 28 urls.append(url)
29 29
30 options.extra_browser_args.append('--enable-gpu-benchmarking') 30 options.extra_browser_args.append('--enable-gpu-benchmarking')
31 browser_to_create = chrome_remote_control.FindBrowser(options) 31 browser_to_create = telemetry.FindBrowser(options)
32 if not browser_to_create: 32 if not browser_to_create:
33 sys.stderr.write('No browser found! Supported types: %s' % 33 sys.stderr.write('No browser found! Supported types: %s' %
34 chrome_remote_control.GetAllAvailableBrowserTypes(options)) 34 telemetry.GetAllAvailableBrowserTypes(options))
35 return 255 35 return 255
36 with browser_to_create.Create() as b: 36 with browser_to_create.Create() as b:
37 with b.ConnectToNthTab(0) as tab: 37 with b.ConnectToNthTab(0) as tab:
38 # Check browser for benchmark API. Can only be done on non-chrome URLs. 38 # Check browser for benchmark API. Can only be done on non-chrome URLs.
39 tab.page.Navigate('http://www.google.com') 39 tab.page.Navigate('http://www.google.com')
40 import time 40 import time
41 time.sleep(2) 41 time.sleep(2)
42 tab.WaitForDocumentReadyStateToBeComplete() 42 tab.WaitForDocumentReadyStateToBeComplete()
43 if tab.runtime.Evaluate('window.chrome.gpuBenchmarking === undefined'): 43 if tab.runtime.Evaluate('window.chrome.gpuBenchmarking === undefined'):
44 print 'Browser does not support gpu benchmarks API.' 44 print 'Browser does not support gpu benchmarks API.'
(...skipping 22 matching lines...) Expand all
67 tab.page.Navigate(u) 67 tab.page.Navigate(u)
68 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() 68 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter()
69 results = tab.runtime.Evaluate( 69 results = tab.runtime.Evaluate(
70 'window.chrome.gpuBenchmarking.runRenderingBenchmarks();') 70 'window.chrome.gpuBenchmarking.runRenderingBenchmarks();')
71 DumpResults(url, results) 71 DumpResults(url, results)
72 72
73 return 0 73 return 0
74 74
75 if __name__ == '__main__': 75 if __name__ == '__main__':
76 sys.exit(Main(sys.argv[1:])) 76 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « tools/telemetry/examples/list_available_browsers ('k') | tools/telemetry/examples/telemetry_perf_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698