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

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

Issue 10875044: Basic framework for devtools-based scrolling tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with the added files Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5 import os
6 import re
7 import sys
8 import time
9 import optparse
10
11 sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
12
13 import chrome_remote_control
14
15 def Main(args):
16 parser = chrome_remote_control.BrowserOptions.CreateParser(
17 "rendering_microbenchmark_test.py <sitelist>")
18 # TODO(nduca): Add test specific options here, if any.
19 options, args = parser.parse_args()
20 if len(args) != 1:
21 parser.print_usage()
22 return 255
23
24 urls = []
25 with open(args[0], "r") as f:
26 for url in f.readlines():
27 url = url.strip()
28 if not re.match("(.+)://", url):
29 url = "http://%s" % url
30 urls.append(url)
31
32 options.extra_browser_args.append("--enable-gpu-benchmarking")
33 browser_to_create = chrome_remote_control.FindBestPossibleBrowser(options)
34 if not browser_to_create:
35 sys.stderr.write("No browser found! Supported types: %s" %
36 chrome_remote_control.GetAllAvailableBrowserTypes())
37 return 255
38 with browser_to_create.Create() as b:
39 with b.ConnectToNthTab(0) as tab:
40 # Check browser for benchmark API. Can only be done on non-chrome URLs.
41 tab.BeginToLoadURL("http://www.google.com")
42 tab.WaitForDocumentReadyStateToBeComplete()
43 if tab.runtime.Evaluate("window.chrome.gpuBenchmarking === undefined"):
44 print "Browser does not support gpu benchmarks API."
45 return 255
46
47 if tab.runtime.Evaluate(
48 "window.chrome.gpuBenchmarking.runRenderingBenchmarks === undefined"):
49 print "Browser does not support rendering benchmarks API."
50 return 255
51
52 # Run the test. :)
53 first_line = []
54 def DumpResults(results):
55 if len(first_line) == 0:
56 cols = ["url"]
57 for r in results:
58 cols.append(r["benchmark"])
59 print ",".join(cols)
60 first_line.append(0)
61 cols = [u]
62 for r in results:
63 cols.append(str(r["result"]))
64 print ",".join(cols)
65
66 for u in urls:
67 tab.BeginToLoadURL(u)
68 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter()
69 results = tab.runtime.Evaluate(
70 "window.chrome.gpuBenchmarking.runRenderingBenchmarks();")
71 DumpResults(results)
72
73 return 0
74
75 if __name__ == "__main__":
76 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « tools/chrome_remote_control/chrome_remote_control/websocket_unittest.py ('k') | tools/chrome_remote_control/examples/top1k » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698