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

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: with the added files 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..01220b548c4463d52d6c7ae714cb4d098c4d5721
--- /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 re
+import sys
+import time
+import optparse
+
+sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
+
+import chrome_remote_control
+
+def Main(args):
+ parser = chrome_remote_control.BrowserOptions.CreateParser(
+ "rendering_microbenchmark_test.py <sitelist>")
+ # TODO(nduca): Add test specific options here, if any.
+ options, args = parser.parse_args()
+ 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 re.match("(.+)://", url):
+ url = "http://%s" % url
+ urls.append(url)
+
+ options.extra_browser_args.append("--enable-gpu-benchmarking")
+ browser_to_create = chrome_remote_control.FindBestPossibleBrowser(options)
+ if not browser_to_create:
+ sys.stderr.write("No browser found! Supported types: %s" %
+ chrome_remote_control.GetAllAvailableBrowserTypes())
+ return 255
+ with browser_to_create.Create() 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.runtime.Evaluate("window.chrome.gpuBenchmarking === undefined"):
+ print "Browser does not support gpu benchmarks API."
+ return 255
+
+ if tab.runtime.Evaluate(
+ "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.runtime.Evaluate(
+ "window.chrome.gpuBenchmarking.runRenderingBenchmarks();")
+ DumpResults(results)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(Main(sys.argv))
« 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