| Index: tools/perf/page_sets/system_health/multi_tab_stories.py
|
| diff --git a/tools/perf/page_sets/system_health/multi_tab_stories.py b/tools/perf/page_sets/system_health/multi_tab_stories.py
|
| index a9ab0c741024d2fa37508cdd7157ea010c4e384d..5583ad63f1c8ba70b67dbd142a4946a5b155ff77 100644
|
| --- a/tools/perf/page_sets/system_health/multi_tab_stories.py
|
| +++ b/tools/perf/page_sets/system_health/multi_tab_stories.py
|
| @@ -15,16 +15,26 @@ from telemetry import benchmark
|
| class MultiTabStory(system_health_story.SystemHealthStory):
|
| ABSTRACT_STORY = True
|
|
|
| + def __init__(self, story_set, take_memory_measurement):
|
| + super(MultiTabStory, self).__init__(story_set, take_memory_measurement)
|
| + self._pageset_repeat = 1
|
| +
|
| + def Run(self, shared_state):
|
| + finder_options = getattr(shared_state, '_finder_options')
|
| + self._pageset_repeat = finder_options.pageset_repeat
|
| + super(MultiTabStory, self).Run(shared_state)
|
| +
|
| def RunNavigateSteps(self, action_runner):
|
| tabs = action_runner.tab.browser.tabs
|
|
|
| - # No need to create the first tab as there is already one
|
| - # when the browser is ready,
|
| - if self.URL_LIST:
|
| - action_runner.Navigate(self.URL_LIST[0])
|
| - for url in self.URL_LIST[1:]:
|
| - new_tab = tabs.New()
|
| - new_tab.action_runner.Navigate(url)
|
| + # If this is the first pageset, don't have to create the first tab
|
| + # as there is already one when the browser is ready,
|
| + for i, url in enumerate(self.URL_LIST):
|
| + if i == 0 and len(action_runner.tab.browser.tabs) == 1:
|
| + action_runner.Navigate(url)
|
| + else:
|
| + new_tab = tabs.New()
|
| + new_tab.action_runner.Navigate(url)
|
|
|
| for i, url in enumerate(self.URL_LIST):
|
| try:
|
| @@ -34,6 +44,13 @@ class MultiTabStory(system_health_story.SystemHealthStory):
|
| % (i, url))
|
|
|
| def RunPageInteractions(self, action_runner):
|
| + # if tab switching on every pageset, the metrics data would be a mix of
|
| + # tab switching on different tab counts and is hard to analyze. only
|
| + # tab switching on the last pageset
|
| + if self._pageset_repeat != 1 and len(action_runner.tab.browser.tabs) != \
|
| + len(self.URL_LIST) * self._pageset_repeat:
|
| + return
|
| +
|
| for tab in action_runner.tab.browser.tabs:
|
| tab.Activate()
|
| tab.WaitForFrameToBeDisplayed()
|
|
|