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

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: Created 8 years, 4 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 sys
7 import time
8 import optparse
9
10 sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
11
12 import chrome_remote_control.browser
13 import chrome_remote_control.browser_options
14
15 class TestUtils(object):
dtu 2012/08/24 08:55:43 Class is never used. Remove.
16 def __init__(self, tab):
17 self._tab = tab
18
19 def Main(args):
20 parser = chrome_remote_control.browser_options.BrowserOptions.CreateParser(
21 "rendering_microbenchmark_test.py <sitelist>")
22 # TODO(nduca): Add test specific options here, if any.
23 options, args = parser.parse_args()
24 options.canary = True
25 if len(args) != 1:
26 parser.print_usage()
27 return 255
28
29 urls = []
30 with open(args[0], "r") as f:
31 for url in f.readlines():
32 url = url.strip()
33 if not url.startswith("http://"):
dtu 2012/08/24 08:55:43 if not url.startswith("http://") and not url.start
34 url = "http://%s" % url
35 urls.append(url)
36
37 options.args.append("--enable-gpu-benchmarking")
38 with chrome_remote_control.browser.Browser(options) 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.RuntimeEvaluate("window.chrome.gpuBenchmarking === undefined"):
44 print "Browser does not support gpu benchmarks API."
45 return 255
46
47 if tab.RuntimeEvaluate(
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.RuntimeEvaluate(
70 "window.chrome.gpuBenchmarking.runRenderingBenchmarks();")
71 DumpResults(results)
72
73 return 0
74
75 if __name__ == "__main__":
76 sys.exit(Main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698