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

Side by Side Diff: tools/perf/page_sets/todomvc.py

Issue 2618333006: [tools/perf] Fix JavaScript interpolation in action_runner calls (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 as page_module 5 from telemetry.page import page as page_module
6 from telemetry.page import shared_page_state 6 from telemetry.page import shared_page_state
7 from telemetry import story 7 from telemetry import story
8 8
9 9
10 URL_LIST = [ 10 URL_LIST = [
(...skipping 14 matching lines...) Expand all
25 class TodoMVCPage(page_module.Page): 25 class TodoMVCPage(page_module.Page):
26 26
27 def __init__(self, url, page_set, name): 27 def __init__(self, url, page_set, name):
28 super(TodoMVCPage, self).__init__( 28 super(TodoMVCPage, self).__init__(
29 url=url, page_set=page_set, name=name, 29 url=url, page_set=page_set, name=name,
30 shared_page_state_class=shared_page_state.SharedDesktopPageState) 30 shared_page_state_class=shared_page_state.SharedDesktopPageState)
31 # TODO(jochen): This interaction does not include the 31 # TODO(jochen): This interaction does not include the
32 # WindowProxy::initialize portion before the commit. To fix this, we'll 32 # WindowProxy::initialize portion before the commit. To fix this, we'll
33 # have to migrate to TBMv2. 33 # have to migrate to TBMv2.
34 self.script_to_evaluate_on_commit = ( 34 self.script_to_evaluate_on_commit = (
35 'console.time("%s");' % INTERACTION_NAME) 35 'console.time("%s");' % INTERACTION_NAME)
nednguyen 2017/01/10 14:42:23 also change here
perezju 2017/01/10 14:53:01 Done.
36 36
37 def RunPageInteractions(self, action_runner): 37 def RunPageInteractions(self, action_runner):
38 action_runner.ExecuteJavaScript( 38 action_runner.ExecuteJavaScript(
39 """ 39 """
40 this.becameIdle = false; 40 this.becameIdle = false;
41 this.idleCallback = function(deadline) { 41 this.idleCallback = function(deadline) {
42 if (deadline.timeRemaining() > 20) 42 if (deadline.timeRemaining() > 20)
43 this.becameIdle = true; 43 this.becameIdle = true;
44 else 44 else
45 requestIdleCallback(this.idleCallback); 45 requestIdleCallback(this.idleCallback);
46 }; 46 };
47 requestIdleCallback(this.idleCallback); 47 requestIdleCallback(this.idleCallback);
48 """ 48 """
49 ) 49 )
50 action_runner.WaitForJavaScriptCondition('this.becameIdle === true') 50 action_runner.WaitForJavaScriptCondition('this.becameIdle === true')
51 # TODO(catapult:#3028): Fix interpolation of JavaScript values. 51 action_runner.ExecuteJavaScript(
52 action_runner.ExecuteJavaScript('console.timeEnd("%s");' % INTERACTION_NAME) 52 'console.timeEnd({{ label }});', label=INTERACTION_NAME)
53 53
54 54
55 class TodoMVCPageSet(story.StorySet): 55 class TodoMVCPageSet(story.StorySet):
56 56
57 """ TodoMVC examples """ 57 """ TodoMVC examples """
58 58
59 def __init__(self): 59 def __init__(self):
60 super(TodoMVCPageSet, self).__init__( 60 super(TodoMVCPageSet, self).__init__(
61 archive_data_file='data/todomvc.json', 61 archive_data_file='data/todomvc.json',
62 cloud_storage_bucket=story.PUBLIC_BUCKET) 62 cloud_storage_bucket=story.PUBLIC_BUCKET)
63 63
64 for name, url in URL_LIST: 64 for name, url in URL_LIST:
65 self.AddStory(TodoMVCPage(url, self, name)) 65 self.AddStory(TodoMVCPage(url, self, name))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698