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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/chrome_remote_control/examples/rendering_microbenchmark_test.py
diff --git a/tools/chrome_remote_control/examples/rendering_microbenchmark_test.py b/tools/chrome_remote_control/examples/rendering_microbenchmark_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..387adf5073e0cce745954fddb047ac88f34ad89f
--- /dev/null
+++ b/tools/chrome_remote_control/examples/rendering_microbenchmark_test.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import os
+import sys
+import time
+import optparse
+
+sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
+
+import chrome_remote_control.browser
+import chrome_remote_control.browser_options
+
+class TestUtils(object):
dtu 2012/08/24 08:55:43 Class is never used. Remove.
+ def __init__(self, tab):
+ self._tab = tab
+
+def Main(args):
+ parser = chrome_remote_control.browser_options.BrowserOptions.CreateParser(
+ "rendering_microbenchmark_test.py <sitelist>")
+ # TODO(nduca): Add test specific options here, if any.
+ options, args = parser.parse_args()
+ options.canary = True
+ if len(args) != 1:
+ parser.print_usage()
+ return 255
+
+ urls = []
+ with open(args[0], "r") as f:
+ for url in f.readlines():
+ url = url.strip()
+ if not url.startswith("http://"):
dtu 2012/08/24 08:55:43 if not url.startswith("http://") and not url.start
+ url = "http://%s" % url
+ urls.append(url)
+
+ options.args.append("--enable-gpu-benchmarking")
+ with chrome_remote_control.browser.Browser(options) as b:
+ with b.ConnectToNthTab(0) as tab:
+ # Check browser for benchmark API. Can only be done on non-chrome URLs.
+ tab.BeginToLoadURL("http://www.google.com")
+ tab.WaitForDocumentReadyStateToBeComplete()
+ if tab.RuntimeEvaluate("window.chrome.gpuBenchmarking === undefined"):
+ print "Browser does not support gpu benchmarks API."
+ return 255
+
+ if tab.RuntimeEvaluate(
+ "window.chrome.gpuBenchmarking.runRenderingBenchmarks === undefined"):
+ print "Browser does not support rendering benchmarks API."
+ return 255
+
+ # Run the test. :)
+ first_line = []
+ def DumpResults(results):
+ if len(first_line) == 0:
+ cols = ["url"]
+ for r in results:
+ cols.append(r["benchmark"])
+ print ",".join(cols)
+ first_line.append(0)
+ cols = [u]
+ for r in results:
+ cols.append(str(r["result"]))
+ print ",".join(cols)
+
+ for u in urls:
+ tab.BeginToLoadURL(u)
+ tab.WaitForDocumentReadyStateToBeInteractiveOrBetter()
+ results = tab.RuntimeEvaluate(
+ "window.chrome.gpuBenchmarking.runRenderingBenchmarks();")
+ DumpResults(results)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(Main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698