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

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

Issue 277143003: Add NavigateToPage API for action_runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 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 | « tools/perf/benchmarks/maps.py ('k') | tools/perf/measurements/smoothness_controller.py » ('j') | 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.actions.all_page_actions import NavigateAction, WaitAction 5 from telemetry.page.actions.all_page_actions import WaitAction
6 from telemetry.page import page 6 from telemetry.page import page
7 from telemetry.page import page_measurement 7 from telemetry.page import page_measurement
8 8
9 9
10 class PageForPolymerLoad(page.Page): 10 class PageForPolymerLoad(page.Page):
11 11
12 def __init__(self, url, page_set): 12 def __init__(self, url, page_set):
13 super(PageForPolymerLoad, self).__init__( 13 super(PageForPolymerLoad, self).__init__(
14 url=url, 14 url=url,
15 page_set=page_set) 15 page_set=page_set)
16 self.script_to_evaluate_on_commit = ''' 16 self.script_to_evaluate_on_commit = '''
17 document.addEventListener("polymer-ready", function() { 17 document.addEventListener("polymer-ready", function() {
18 var unused = document.body.offsetHeight; 18 var unused = document.body.offsetHeight;
19 window.__polymer_ready_time = performance.now(); 19 window.__polymer_ready_time = performance.now();
20 setTimeout(function() { 20 setTimeout(function() {
21 window.__polymer_ready = true; 21 window.__polymer_ready = true;
22 }, 1000); 22 }, 1000);
23 }) 23 })
24 ''' 24 '''
25 25
26 def RunNavigateSteps(self, action_runner): 26 def RunNavigateSteps(self, action_runner):
27 action_runner.RunAction(NavigateAction()) 27 action_runner.NavigateToPage(self)
28 action_runner.RunAction(WaitAction( 28 action_runner.RunAction(WaitAction(
29 { 29 {
30 'javascript': "window.__polymer_ready" 30 'javascript': "window.__polymer_ready"
31 })) 31 }))
32 32
33 33
34 class PolymerLoadMeasurement(page_measurement.PageMeasurement): 34 class PolymerLoadMeasurement(page_measurement.PageMeasurement):
35 def MeasurePage(self, _, tab, results): 35 def MeasurePage(self, _, tab, results):
36 result = int(tab.EvaluateJavaScript('__polymer_ready_time')) 36 result = int(tab.EvaluateJavaScript('__polymer_ready_time'))
37 results.Add('Total', 'ms', result) 37 results.Add('Total', 'ms', result)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/maps.py ('k') | tools/perf/measurements/smoothness_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698