OLD | NEW |
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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 for url in f.readlines(): | 25 for url in f.readlines(): |
26 url = url.strip() | 26 url = url.strip() |
27 if not re.match("(.+)://", url): | 27 if not re.match("(.+)://", url): |
28 url = "http://%s" % url | 28 url = "http://%s" % url |
29 urls.append(url) | 29 urls.append(url) |
30 | 30 |
31 options.extra_browser_args.append("--enable-gpu-benchmarking") | 31 options.extra_browser_args.append("--enable-gpu-benchmarking") |
32 browser_to_create = chrome_remote_control.FindBrowser(options) | 32 browser_to_create = chrome_remote_control.FindBrowser(options) |
33 if not browser_to_create: | 33 if not browser_to_create: |
34 sys.stderr.write("No browser found! Supported types: %s" % | 34 sys.stderr.write("No browser found! Supported types: %s" % |
35 chrome_remote_control.GetAllAvailableBrowserTypes()) | 35 chrome_remote_control.GetAllAvailableBrowserTypes(options)) |
36 return 255 | 36 return 255 |
37 with browser_to_create.Create() as b: | 37 with browser_to_create.Create() as b: |
38 with b.ConnectToNthTab(0) as tab: | 38 with b.ConnectToNthTab(0) as tab: |
39 # Check browser for benchmark API. Can only be done on non-chrome URLs. | 39 # Check browser for benchmark API. Can only be done on non-chrome URLs. |
40 tab.page.Navigate("http://www.google.com") | 40 tab.page.Navigate("http://www.google.com") |
41 import time | 41 import time |
42 time.sleep(2) | 42 time.sleep(2) |
43 tab.WaitForDocumentReadyStateToBeComplete() | 43 tab.WaitForDocumentReadyStateToBeComplete() |
44 if tab.runtime.Evaluate("window.chrome.gpuBenchmarking === undefined"): | 44 if tab.runtime.Evaluate("window.chrome.gpuBenchmarking === undefined"): |
45 print "Browser does not support gpu benchmarks API." | 45 print "Browser does not support gpu benchmarks API." |
(...skipping 22 matching lines...) Expand all Loading... |
68 tab.page.Navigate(u) | 68 tab.page.Navigate(u) |
69 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() | 69 tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() |
70 results = tab.runtime.Evaluate( | 70 results = tab.runtime.Evaluate( |
71 "window.chrome.gpuBenchmarking.runRenderingBenchmarks();") | 71 "window.chrome.gpuBenchmarking.runRenderingBenchmarks();") |
72 DumpResults(url, results) | 72 DumpResults(url, results) |
73 | 73 |
74 return 0 | 74 return 0 |
75 | 75 |
76 if __name__ == "__main__": | 76 if __name__ == "__main__": |
77 sys.exit(Main(sys.argv[1:])) | 77 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |