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 = [ |
(...skipping 23 matching lines...) Expand all Loading... |
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) |
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 let idletime = deadline.timeRemaining(); | 42 let idletime = deadline.timeRemaining(); |
43 console.time("time remaining: " + idletime); | 43 console.time("time remaining: " + idletime); |
44 if (idletime > 10) | 44 if (idletime > 20) |
45 this.becameIdle = true; | 45 this.becameIdle = true; |
46 else | 46 else |
47 requestIdleCallback(this.idleCallback); | 47 requestIdleCallback(this.idleCallback); |
48 console.timeEnd("time remaining: " + idletime); | 48 console.timeEnd("time remaining: " + idletime); |
49 }; | 49 }; |
50 requestIdleCallback(this.idleCallback); | 50 requestIdleCallback(this.idleCallback); |
51 """ | 51 """ |
52 ) | 52 ) |
53 action_runner.WaitForJavaScriptCondition('this.becameIdle === true') | 53 action_runner.WaitForJavaScriptCondition('this.becameIdle === true') |
54 action_runner.ExecuteJavaScript('console.timeEnd("%s");' % INTERACTION_NAME) | 54 action_runner.ExecuteJavaScript('console.timeEnd("%s");' % INTERACTION_NAME) |
55 | 55 |
56 | 56 |
57 class TodoMVCPageSet(story.StorySet): | 57 class TodoMVCPageSet(story.StorySet): |
58 | 58 |
59 """ TodoMVC examples """ | 59 """ TodoMVC examples """ |
60 | 60 |
61 def __init__(self): | 61 def __init__(self): |
62 super(TodoMVCPageSet, self).__init__( | 62 super(TodoMVCPageSet, self).__init__( |
63 archive_data_file='data/todomvc.json', | 63 archive_data_file='data/todomvc.json', |
64 cloud_storage_bucket=story.PUBLIC_BUCKET) | 64 cloud_storage_bucket=story.PUBLIC_BUCKET) |
65 | 65 |
66 for name, url in URL_LIST: | 66 for name, url in URL_LIST: |
67 self.AddStory(TodoMVCPage(url, self, name)) | 67 self.AddStory(TodoMVCPage(url, self, name)) |
OLD | NEW |