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

Unified Diff: tools/telemetry/telemetry/user_story/user_story_set.py

Issue 612963002: Introduce UserStory & UserStorySet classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up staticmethods related to PageCreation Created 6 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
Index: tools/telemetry/telemetry/user_story/user_story_set.py
diff --git a/tools/telemetry/telemetry/user_story/user_story_set.py b/tools/telemetry/telemetry/user_story/user_story_set.py
new file mode 100644
index 0000000000000000000000000000000000000000..cee65d422427a987f81f919537a9e18996913749
--- /dev/null
+++ b/tools/telemetry/telemetry/user_story/user_story_set.py
@@ -0,0 +1,47 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from telemetry import user_story as user_story_module
+
+
+class UserStorySet(object):
+ def __init__(self):
+ self.user_stories = []
+
+ def AddUserStory(self, user_story):
+ assert isinstance(user_story, user_story_module.UserStory)
+ self.user_stories.append(user_story)
+
+ @classmethod
+ def Name(cls):
+ """ Returns the string name of this UserStorySet.
+ Note that this should be a classmethod so test_runner script can match
+ user story class with its name specified in the run command:
+ 'Run <User story test name> <User story class name>'
+ """
+ return cls.__module__.split('.')[-1]
+
+ @classmethod
+ def Description(cls):
+ """ Return a string explaining in human-understandable terms what this
+ user story represents.
+ Note that this should be a classmethod so test_runner script can
+ display user stories' names along their descriptions in the list commmand.
+ """
+ if cls.__doc__:
+ return cls.__doc__.splitlines()[0]
+ else:
+ return ''
+
+ def __iter__(self):
+ return self.user_stories.__iter__()
+
+ def __len__(self):
+ return len(self.user_stories)
+
+ def __getitem__(self, key):
+ return self.user_stories[key]
+
+ def __setitem__(self, key, value):
+ self.user_stories[key] = value
« no previous file with comments | « tools/telemetry/telemetry/user_story/__init__.py ('k') | tools/telemetry/telemetry/user_story/user_story_test_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698