Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 = [ |
| 11 ('Polymer', 'http://todomvc.com/examples/polymer'), | 11 ('Polymer', 'http://todomvc.com/examples/polymer'), |
| 12 ('AngularJS', 'http://todomvc.com/examples/angularjs'), | 12 ('AngularJS', 'http://todomvc.com/examples/angularjs'), |
| 13 ('React', 'http://todomvc.com/examples/react'), | 13 ('React', 'http://todomvc.com/examples/react'), |
| 14 ('Backbone.js', 'http://todomvc.com/examples/backbone'), | 14 ('Backbone.js', 'http://todomvc.com/examples/backbone'), |
| 15 ('Ember.js', 'http://todomvc.com/examples/emberjs'), | 15 ('Ember.js', 'http://todomvc.com/examples/emberjs'), |
| 16 ('Closure', 'http://todomvc.com/examples/closure'), | 16 ('Closure', 'http://todomvc.com/examples/closure'), |
| 17 ('GWT', 'http://todomvc.com/examples/gwt'), | 17 ('GWT', 'http://todomvc.com/examples/gwt'), |
| 18 ('Dart', 'http://todomvc.com/examples/vanilladart/build/web'), | 18 ('Dart', 'http://todomvc.com/examples/vanilladart/build/web'), |
| 19 ('Vanilla JS', 'http://todomvc.com/examples/vanillajs'), | 19 ('Vanilla JS', 'http://todomvc.com/examples/vanillajs'), |
| 20 ] | 20 ] |
| 21 | 21 |
| 22 INTERACTION_NAME = "Interaction.PageLoading" | |
|
Sami
2016/03/10 12:30:34
nit: Single quote strings please.
| |
| 23 | |
| 22 | 24 |
| 23 class TodoMVCPage(page_module.Page): | 25 class TodoMVCPage(page_module.Page): |
| 24 | 26 |
| 25 def __init__(self, url, page_set, name): | 27 def __init__(self, url, page_set, name): |
| 26 super(TodoMVCPage, self).__init__( | 28 super(TodoMVCPage, self).__init__( |
| 27 url=url, page_set=page_set, name=name, | 29 url=url, page_set=page_set, name=name, |
| 28 shared_page_state_class=shared_page_state.SharedDesktopPageState) | 30 shared_page_state_class=shared_page_state.SharedDesktopPageState) |
| 31 self.script_to_evaluate_on_commit = ( | |
| 32 "console.time('" + INTERACTION_NAME + "');") | |
|
Sami
2016/03/10 12:30:34
nit: How about creating an action_runner.Interacti
jochen (gone - plz use gerrit)
2016/03/10 14:09:22
there is no action runner that would live long eno
| |
| 29 | 33 |
| 30 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
| 31 pass | 35 action_runner.ExecuteJavaScript( |
| 36 """ | |
| 37 this.hasRunRAF = 0; | |
| 38 requestAnimationFrame(function() { | |
|
jochen (gone - plz use gerrit)
2016/03/10 11:41:45
i wonder whether the page load interaction should
Sami
2016/03/10 12:30:34
I'm wondering if both are a little early for some
Camillo Bruni
2016/03/10 12:30:55
It should probably end with window.onLoad, since y
Camillo Bruni
2016/03/10 15:12:53
how about just waiting 4 seconds or so?
| |
| 39 this.hasRunRAF = 1; | |
| 40 console.timeEnd('%s'); | |
| 41 }); | |
| 42 """ % INTERACTION_NAME | |
| 43 ) | |
| 44 action_runner.WaitForJavaScriptCondition("this.hasRunRAF == 1") | |
| 32 | 45 |
| 33 | 46 |
| 34 class TodoMVCPageSet(story.StorySet): | 47 class TodoMVCPageSet(story.StorySet): |
| 35 | 48 |
| 36 """ TodoMVC examples """ | 49 """ TodoMVC examples """ |
| 37 | 50 |
| 38 def __init__(self): | 51 def __init__(self): |
| 39 super(TodoMVCPageSet, self).__init__( | 52 super(TodoMVCPageSet, self).__init__( |
| 40 archive_data_file='data/todomvc.json', | 53 archive_data_file='data/todomvc.json', |
| 41 cloud_storage_bucket=story.PUBLIC_BUCKET) | 54 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 42 | 55 |
| 43 for name, url in URL_LIST: | 56 for name, url in URL_LIST: |
| 44 self.AddStory(TodoMVCPage(url, self, name)) | 57 self.AddStory(TodoMVCPage(url, self, name)) |
| OLD | NEW |