| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import time | 4 import time |
| 5 | 5 |
| 6 from telemetry import story |
| 6 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 7 from telemetry.page import page_set as page_set_module | |
| 8 from telemetry.page import shared_page_state | 8 from telemetry.page import shared_page_state |
| 9 | 9 |
| 10 INTERACTION_NAME = 'Interaction.PageLoading' | 10 INTERACTION_NAME = 'Interaction.PageLoading' |
| 11 | 11 |
| 12 # How long to wait for the page to finish rendering. | 12 # How long to wait for the page to finish rendering. |
| 13 LOADING_DELAY_S = 5 | 13 LOADING_DELAY_S = 5 |
| 14 | 14 |
| 15 | 15 |
| 16 class NewTabPagePage(page_module.Page): | 16 class NewTabPagePage(page_module.Page): |
| 17 | 17 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 # TODO(beaudoin): We have no guarantee the page has fully rendered and the | 34 # TODO(beaudoin): We have no guarantee the page has fully rendered and the |
| 35 # JS has fully executed at that point. The right way to do it would be to | 35 # JS has fully executed at that point. The right way to do it would be to |
| 36 # toggle a Javascript variable in the page code and to wait for it here. | 36 # toggle a Javascript variable in the page code and to wait for it here. |
| 37 # This should be done when window.performance.mark is supported and we | 37 # This should be done when window.performance.mark is supported and we |
| 38 # migrate to it instead of calling console.timeEnd here. If the test is | 38 # migrate to it instead of calling console.timeEnd here. If the test is |
| 39 # failing flakily, we should use a better heuristic. | 39 # failing flakily, we should use a better heuristic. |
| 40 action_runner.ExecuteJavaScript( | 40 action_runner.ExecuteJavaScript( |
| 41 "console.timeEnd('" + INTERACTION_NAME + "');") | 41 "console.timeEnd('" + INTERACTION_NAME + "');") |
| 42 | 42 |
| 43 | 43 |
| 44 class NewTabPagePageSet(page_set_module.PageSet): | 44 class NewTabPagePageSet(story.StorySet): |
| 45 def __init__(self): | 45 def __init__(self): |
| 46 super(NewTabPagePageSet, self).__init__( | 46 super(NewTabPagePageSet, self).__init__( |
| 47 archive_data_file='data/new_tab_page_page.json', | 47 archive_data_file='data/new_tab_page_page.json', |
| 48 bucket=page_set_module.PUBLIC_BUCKET) | 48 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 49 self.AddUserStory(NewTabPagePage(page_set=self)) | 49 self.AddUserStory(NewTabPagePage(page_set=self)) |
| OLD | NEW |