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

Side by Side Diff: tools/perf/perf_tools/first_paint_time_benchmark.py

Issue 11361165: [chrome_remote_control] Rename chrome_remote_control to telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # The test takes a list of URLs through stdin and prints results in CSV format. 5 # The test takes a list of URLs through stdin and prints results in CSV format.
6 # Example: python run_scroll_test.py < data/urls.txt > test_results.csv 6 # Example: python run_scroll_test.py < data/urls.txt > test_results.csv
7 from chrome_remote_control import multi_page_benchmark 7 from telemetry import multi_page_benchmark
8 from chrome_remote_control import util 8 from telemetry import util
9 9
10 class FirstPaintTimeBenchmark(multi_page_benchmark.MultiPageBenchmark): 10 class FirstPaintTimeBenchmark(multi_page_benchmark.MultiPageBenchmark):
11 def MeasurePage(self, _, tab, results): 11 def MeasurePage(self, _, tab, results):
12 if tab.browser.is_content_shell: 12 if tab.browser.is_content_shell:
13 results.Add('first_paint', 'seconds', 'unsupported') 13 results.Add('first_paint', 'seconds', 'unsupported')
14 return 14 return
15 15
16 tab.runtime.Execute(""" 16 tab.runtime.Execute("""
17 window.__rafFired = false; 17 window.__rafFired = false;
18 window.webkitRequestAnimationFrame(function() { 18 window.webkitRequestAnimationFrame(function() {
19 window.__rafFired = true; 19 window.__rafFired = true;
20 }); 20 });
21 """) 21 """)
22 util.WaitFor(lambda: tab.runtime.Evaluate('window.__rafFired'), 60) 22 util.WaitFor(lambda: tab.runtime.Evaluate('window.__rafFired'), 60)
23 23
24 first_paint_secs = tab.runtime.Evaluate( 24 first_paint_secs = tab.runtime.Evaluate(
25 'window.chrome.loadTimes().firstPaintTime - ' + 25 'window.chrome.loadTimes().firstPaintTime - ' +
26 'window.chrome.loadTimes().requestTime') 26 'window.chrome.loadTimes().requestTime')
27 27
28 results.Add('first_paint', 'seconds', round(first_paint_secs, 1)) 28 results.Add('first_paint', 'seconds', round(first_paint_secs, 1))
OLDNEW
« no previous file with comments | « tools/perf/perf_tools/__init__.py ('k') | tools/perf/perf_tools/first_paint_time_benchmark_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698