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

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

Issue 2144073004: [system-health] Unify SH stories interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restrict story selector Created 4 years, 5 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
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 cb7a21b5eaaa9aded941fac24baf85675eb4bfd1..5d916bc37c538689df32bd4233c29a3e6d4b536d 100644
--- a/tools/perf/page_sets/system_health/system_health_story.py
+++ b/tools/perf/page_sets/system_health/system_health_story.py
@@ -6,20 +6,39 @@ import logging
from page_sets.system_health import platforms
-from telemetry.core import discover
from telemetry.page import page
_DUMP_WAIT_TIME = 3
+class _MetaSystemHealthStory(type):
+ """Metaclass for SystemHealthStory."""
+
+ @property
+ def ABSTRACT_STORY(cls):
+ """Class field marking whether the class is abstract.
+
+ If true, the story will NOT be instantiated and added to a System Health
+ story set. This field is NOT inherited by subclasses (that's why it's
+ defined on the metaclass).
+ """
+ return cls.__dict__.get('__ABSTRACT_STORY__', False)
+
+ @ABSTRACT_STORY.setter
+ def ABSTRACT_STORY(cls, ABSTRACT_STORY):
+ cls.__dict__['__ABSTRACT_STORY__'] = ABSTRACT_STORY
+
+
class SystemHealthStory(page.Page):
"""Abstract base class for System Health user stories."""
+ __metaclass__ = _MetaSystemHealthStory
# The full name of a single page story has the form CASE:GROUP:PAGE (e.g.
# 'load:search:google').
NAME = NotImplemented
URL = NotImplemented
+ ABSTRACT_STORY = True
SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
def __init__(self, story_set, take_memory_measurement):
@@ -59,13 +78,3 @@ class SystemHealthStory(page.Page):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
self._DidLoadDocument(action_runner)
self._Measure(action_runner)
-
-
-def IterAllStoryClasses(module, base_class):
- # Sort the classes by their names so that their order is stable and
- # deterministic.
- for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule(
- module=module,
- base_class=base_class,
- index_by_class_name=True).iteritems()):
- yield cls

Powered by Google App Engine
This is Rietveld 408576698