| Index: tools/perf/page_sets/system_health/system_health_story.py
|
| diff --git a/tools/perf/page_sets/system_health/system_health_story.py b/tools/perf/page_sets/system_health/system_health_story.py
|
| index 394710d3c32945e299f8d5528c94f77fa04be051..78b9347b73e0787a72ea31f5d76a5c6da5243b1c 100644
|
| --- a/tools/perf/page_sets/system_health/system_health_story.py
|
| +++ b/tools/perf/page_sets/system_health/system_health_story.py
|
| @@ -4,7 +4,9 @@
|
|
|
| from page_sets.system_health import platforms
|
|
|
| +from telemetry import decorators
|
| from telemetry.page import page
|
| +from telemetry.page import shared_page_state
|
|
|
|
|
| # Extra wait time after the page has loaded required by the loading metric. We
|
| @@ -13,6 +15,32 @@ from telemetry.page import page
|
| _WAIT_TIME_AFTER_LOAD = 10
|
|
|
|
|
| +class _SystemHealthSharedState(shared_page_state.SharedPageState):
|
| + """Shared state which enables disabling stories on individual platforms.
|
| +
|
| + This class adds support for enabling/disabling individual stories on
|
| + individual platforms using the same approaches as for benchmarks:
|
| +
|
| + 1. Disabled/Enabled decorator:
|
| +
|
| + @decorators.Disabled('win')
|
| + class Story(system_health_story.SystemHealthStory):
|
| + ...
|
| +
|
| + 2. ShouldDisable method:
|
| +
|
| + class Story(system_health_story.SystemHealthStory):
|
| + ...
|
| +
|
| + @classmethod
|
| + def ShouldDisable(cls, possible_browser):
|
| + return possible_browser.platform.GetOSName() == 'win'
|
| + """
|
| +
|
| + def CanRunStory(self, story):
|
| + return story.CanRun(self.possible_browser)
|
| +
|
| +
|
| class _MetaSystemHealthStory(type):
|
| """Metaclass for SystemHealthStory."""
|
|
|
| @@ -41,11 +69,28 @@ class SystemHealthStory(page.Page):
|
| def __init__(self, story_set, take_memory_measurement):
|
| case, group, _ = self.NAME.split(':')
|
| super(SystemHealthStory, self).__init__(
|
| - page_set=story_set, name=self.NAME, url=self.URL,
|
| + shared_page_state_class=_SystemHealthSharedState, page_set=story_set,
|
| + name=self.NAME, url=self.URL,
|
| credentials_path='../data/credentials.json',
|
| grouping_keys={'case': case, 'group': group})
|
| self._take_memory_measurement = take_memory_measurement
|
|
|
| + @classmethod
|
| + def CanRun(cls, possible_browser):
|
| + if (decorators.ShouldSkip(cls, possible_browser)[0] or
|
| + cls.ShouldDisable(possible_browser)):
|
| + return False
|
| + return True
|
| +
|
| + @classmethod
|
| + def ShouldDisable(cls, possible_browser):
|
| + """Override this method to disable a story under specific conditions.
|
| +
|
| + This method is modelled after telemetry.benchmark.Benchmark.ShouldDisable().
|
| + """
|
| + del possible_browser
|
| + return False
|
| +
|
| def _Measure(self, action_runner):
|
| if self._take_memory_measurement:
|
| action_runner.MeasureMemory(deterministic_mode=True)
|
|
|