Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: tools/perf/page_sets/system_health/system_health_story.py

Issue 2228103002: [system-health] Add support for disabling individual stories on individual platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/system_health/searching_stories.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6dc4a66dc4d944adf601c898cbf33f5ff6a5a8a0 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.browser)
nednguyen 2016/09/07 18:23:51 Hmhh, the api is CanRun(possible_browser), and not
petrcermak 2016/09/08 10:20:44 Yeah. The reason for this is that we are re-using
nednguyen 2016/09/08 12:56:22 We do keep the possible_browser in https://cs.chro
petrcermak 2016/09/08 18:45:10 Done.
+
+
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)
« no previous file with comments | « tools/perf/page_sets/system_health/searching_stories.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698