Index: tools/perf/page_sets/startup_pages.py |
diff --git a/tools/perf/page_sets/startup_pages.py b/tools/perf/page_sets/startup_pages.py |
index 2ca04aedf73f41e514553b414202257a246d1f4b..5eb8b7b298fcae1c4c61f29ee2f648df578cf218 100644 |
--- a/tools/perf/page_sets/startup_pages.py |
+++ b/tools/perf/page_sets/startup_pages.py |
@@ -2,9 +2,22 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
from telemetry.page import page as page_module |
+from telemetry.page import shared_page_state |
from telemetry import story |
+class BrowserStartupSharedState(shared_page_state.SharedPageState): |
+ """Shared state that restarts the browser for every single story. |
+ """ |
+ |
+ def __init__(self, test, finder_options, story_set): |
+ super(BrowserStartupSharedState, self).__init__( |
+ test, finder_options, story_set) |
+ |
+ def DidRunStory(self, results): |
+ super(BrowserStartupSharedState, self).DidRunStory(results) |
+ self._StopBrowser() |
+ |
class StartedPage(page_module.Page): |
def __init__(self, url, startup_url, page_set): |
@@ -39,3 +52,47 @@ class StartupPagesPageSet(story.StorySet): |
# Horribly complex page - stress test! |
self.AddStory(StartedPage( |
'http://kapook.com', 'http://kapook.com', self)) |
+ |
+ |
+class StartedPageTBM(page_module.Page): |
+ |
+ def __init__(self, url, page_set): |
+ super(StartedPageTBM, self).__init__( |
+ url=url, page_set=page_set, startup_url=url, |
+ shared_page_state_class=BrowserStartupSharedState) |
+ self.archive_data_file = 'data/startup_pages.json' |
+ |
+ def RunNavigateSteps(self, action_runner): |
+ # Do not call super.RunNavigateSteps() to not reload the page that has |
+ # already been opened with startup_url. |
+ |
+ # It is still not clear why we would need to wait 10s here. It has been |
eakuefner
2015/11/17 16:51:52
Put this text in the bug and replace this comment
gabadie
2015/11/17 18:14:23
Done.
|
+ # here since the begining (bf5c7d375e881e8d7fa8b7e36f8b87587751ae84). Its |
+ # purpose was to make sure the low priority task in charge of outputing the |
+ # the histogram values we were interested in, was executed before stoping |
+ # the browser. We might be able to get ride of it (crbug.com/555504). |
+ action_runner.Wait(10) |
+ |
+ def RunPageInteractions(self, action_runner): |
+ self.RunNavigateSteps(action_runner) |
+ |
+ |
+class StartupPagesPageSetTBM(story.StorySet): |
eakuefner
2015/11/17 16:51:52
Seems like you need to record this page set using
eakuefner
2015/11/17 17:54:02
Whoops, since you're pointing to an archive_data_f
|
+ |
+ """ Pages for testing starting Chrome with a URL. |
+ Note that this file can't be used with record_wpr, since record_wpr requires |
+ a true navigate step, which we do not want for startup testing. Instead use |
+ record_wpr startup_pages_record to record data for this test. |
+ """ |
+ |
+ def __init__(self): |
+ super(StartupPagesPageSetTBM, self).__init__( |
+ archive_data_file='data/startup_pages.json', |
+ cloud_storage_bucket=story.PARTNER_BUCKET) |
+ |
+ # Typical page. |
+ self.AddStory(StartedPageTBM('about:blank', self)) |
+ # Typical page. |
+ self.AddStory(StartedPageTBM('http://bbc.co.uk', self)) |
+ # Horribly complex page - stress test! |
+ self.AddStory(StartedPageTBM('http://kapook.com', self)) |