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

Side by Side Diff: tools/telemetry/telemetry/user_story/user_story_set.py

Issue 808893002: [Telemetry] Remove session_restore's use of PageTest.CanRunForPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add UserStorySet.RemoveUserStory Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import inspect 5 import inspect
6 import os 6 import os
7 7
8 from telemetry import user_story as user_story_module 8 from telemetry import user_story as user_story_module
9 from telemetry.wpr import archive_info 9 from telemetry.wpr import archive_info
10 10
11 11
12 class UserStorySet(object): 12 class UserStorySet(object):
13 """A collection of user story. 13 """A collection of user story.
14 14
15 A typical usage of UserStorySet would be to subclass it and then calling 15 A typical usage of UserStorySet would be to subclass it and then calling
16 AddUserStory for each UserStory.. 16 AddUserStory for each UserStory..
qyearsley 2015/01/28 19:39:08 Extra ".".
slamm 2015/02/23 23:46:35 Done.
17 """ 17 """
18 18
19 def __init__(self, archive_data_file='', cloud_storage_bucket=None, 19 def __init__(self, archive_data_file='', cloud_storage_bucket=None,
20 serving_dirs=None): 20 serving_dirs=None):
21 """Creates a new UserStorySet. 21 """Creates a new UserStorySet.
22 22
23 Args: 23 Args:
24 archive_data_file: The path to Web Page Replay's archive data, relative 24 archive_data_file: The path to Web Page Replay's archive data, relative
25 to self.base_dir. 25 to self.base_dir.
26 cloud_storage_bucket: The cloud storage bucket used to download 26 cloud_storage_bucket: The cloud storage bucket used to download
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 """Lazily constructs wpr_archive_info if it's not set and returns it.""" 63 """Lazily constructs wpr_archive_info if it's not set and returns it."""
64 if self.archive_data_file and not self._wpr_archive_info: 64 if self.archive_data_file and not self._wpr_archive_info:
65 self._wpr_archive_info = archive_info.WprArchiveInfo.FromFile( 65 self._wpr_archive_info = archive_info.WprArchiveInfo.FromFile(
66 os.path.join(self.base_dir, self.archive_data_file), self.bucket) 66 os.path.join(self.base_dir, self.archive_data_file), self.bucket)
67 return self._wpr_archive_info 67 return self._wpr_archive_info
68 68
69 def AddUserStory(self, user_story): 69 def AddUserStory(self, user_story):
70 assert isinstance(user_story, user_story_module.UserStory) 70 assert isinstance(user_story, user_story_module.UserStory)
71 self.user_stories.append(user_story) 71 self.user_stories.append(user_story)
72 72
73 def RemoveUserStory(self, user_story):
74 """Remove a user story.
qyearsley 2015/01/28 19:39:08 1. The verb in the docstring should be third-perso
slamm 2015/02/23 23:46:35 Done.
75
76 Allows the user stories to be filtered.
77 """
78 self.user_stories.remove(user_story)
79
73 @classmethod 80 @classmethod
74 def Name(cls): 81 def Name(cls):
75 """ Returns the string name of this UserStorySet. 82 """ Returns the string name of this UserStorySet.
qyearsley 2015/01/28 19:39:08 Outside the scope of this CL: There's an extra spa
slamm 2015/02/23 23:46:35 Done. These extra spaces are all over the place.
76 Note that this should be a classmethod so benchmark_runner script can match 83 Note that this should be a classmethod so benchmark_runner script can match
77 user story class with its name specified in the run command: 84 user story class with its name specified in the run command:
78 'Run <User story test name> <User story class name>' 85 'Run <User story test name> <User story class name>'
79 """ 86 """
80 return cls.__module__.split('.')[-1] 87 return cls.__module__.split('.')[-1]
81 88
82 @classmethod 89 @classmethod
83 def Description(cls): 90 def Description(cls):
84 """ Return a string explaining in human-understandable terms what this 91 """ Return a string explaining in human-understandable terms what this
85 user story represents. 92 user story represents.
(...skipping 26 matching lines...) Expand all
112 return self.user_stories.__iter__() 119 return self.user_stories.__iter__()
113 120
114 def __len__(self): 121 def __len__(self):
115 return len(self.user_stories) 122 return len(self.user_stories)
116 123
117 def __getitem__(self, key): 124 def __getitem__(self, key):
118 return self.user_stories[key] 125 return self.user_stories[key]
119 126
120 def __setitem__(self, key, value): 127 def __setitem__(self, key, value):
121 self.user_stories[key] = value 128 self.user_stories[key] = value
OLDNEW
« tools/perf/benchmarks/session_restore.py ('K') | « tools/perf/benchmarks/session_restore.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698