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

Side by Side Diff: tools/perf/measurements/polymer_load.py

Issue 379913002: Update polymer_load to use results.AddValue(...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 from telemetry.page import page 5 from telemetry.page import page
6 from telemetry.page import page_measurement 6 from telemetry.page import page_measurement
7 from telemetry.value import scalar
7 8
8 9
9 class PageForPolymerLoad(page.Page): 10 class PageForPolymerLoad(page.Page):
10 11
11 def __init__(self, url, page_set): 12 def __init__(self, url, page_set):
12 super(PageForPolymerLoad, self).__init__( 13 super(PageForPolymerLoad, self).__init__(
13 url=url, 14 url=url,
14 page_set=page_set) 15 page_set=page_set)
15 self.script_to_evaluate_on_commit = ''' 16 self.script_to_evaluate_on_commit = '''
16 document.addEventListener("polymer-ready", function() { 17 document.addEventListener("polymer-ready", function() {
17 var unused = document.body.offsetHeight; 18 var unused = document.body.offsetHeight;
18 window.__polymer_ready_time = performance.now(); 19 window.__polymer_ready_time = performance.now();
19 setTimeout(function() { 20 setTimeout(function() {
20 window.__polymer_ready = true; 21 window.__polymer_ready = true;
21 }, 1000); 22 }, 1000);
22 }) 23 })
23 ''' 24 '''
24 25
25 def RunNavigateSteps(self, action_runner): 26 def RunNavigateSteps(self, action_runner):
26 action_runner.NavigateToPage(self) 27 action_runner.NavigateToPage(self)
27 action_runner.WaitForJavaScriptCondition('window.__polymer_ready') 28 action_runner.WaitForJavaScriptCondition('window.__polymer_ready')
28 29
29 30
30 class PolymerLoadMeasurement(page_measurement.PageMeasurement): 31 class PolymerLoadMeasurement(page_measurement.PageMeasurement):
31 def MeasurePage(self, _, tab, results): 32 def MeasurePage(self, _, tab, results):
32 result = int(tab.EvaluateJavaScript('__polymer_ready_time')) 33 result = int(tab.EvaluateJavaScript('__polymer_ready_time'))
33 results.Add('Total', 'ms', result) 34 results.AddValue(scalar.ScalarValue(
35 results.current_page, 'Total', 'ms', result))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698