OLD | NEW |
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 optparse | 5 import optparse |
6 | 6 |
7 from catapult_base import cloud_storage | 7 from catapult_base import cloud_storage |
8 from telemetry.core import command_line | 8 from telemetry.core import command_line |
9 from telemetry import decorators | 9 from telemetry import decorators |
10 from telemetry.internal.results import results_options | 10 from telemetry.internal.results import results_options |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return timeline_based_measurement.TimelineBasedMeasurement(opts) | 243 return timeline_based_measurement.TimelineBasedMeasurement(opts) |
244 | 244 |
245 def CreatePageSet(self, options): # pylint: disable=unused-argument | 245 def CreatePageSet(self, options): # pylint: disable=unused-argument |
246 """Get the page set this test will run on. | 246 """Get the page set this test will run on. |
247 | 247 |
248 By default, it will create a page set from the this test's page_set | 248 By default, it will create a page set from the this test's page_set |
249 attribute. Override to generate a custom page set. | 249 attribute. Override to generate a custom page set. |
250 """ | 250 """ |
251 if not hasattr(self, 'page_set'): | 251 if not hasattr(self, 'page_set'): |
252 raise NotImplementedError('This test has no "page_set" attribute.') | 252 raise NotImplementedError('This test has no "page_set" attribute.') |
253 if not issubclass(self.page_set, page_set.PageSet): | |
254 raise TypeError('"%s" is not a PageSet.' % self.page_set.__name__) | |
255 return self.page_set() | 253 return self.page_set() |
256 | 254 |
257 def CreateStorySet(self, options): | 255 def CreateStorySet(self, options): |
258 """Creates the instance of StorySet used to run the benchmark. | 256 """Creates the instance of StorySet used to run the benchmark. |
259 | 257 |
260 Can be overridden by subclasses. | 258 Can be overridden by subclasses. |
261 """ | 259 """ |
262 return self.CreatePageSet(options) | 260 return self.CreatePageSet(options) |
263 | 261 |
264 @classmethod | 262 @classmethod |
265 def CreateExpectations(cls): | 263 def CreateExpectations(cls): |
266 """Get the expectations this test will run with. | 264 """Get the expectations this test will run with. |
267 | 265 |
268 By default, it will create an empty expectations set. Override to generate | 266 By default, it will create an empty expectations set. Override to generate |
269 custom expectations. | 267 custom expectations. |
270 """ | 268 """ |
271 return test_expectations.TestExpectations() | 269 return test_expectations.TestExpectations() |
272 | 270 |
273 | 271 |
274 def AddCommandLineArgs(parser): | 272 def AddCommandLineArgs(parser): |
275 story_runner.AddCommandLineArgs(parser) | 273 story_runner.AddCommandLineArgs(parser) |
276 | 274 |
277 | 275 |
278 def ProcessCommandLineArgs(parser, args): | 276 def ProcessCommandLineArgs(parser, args): |
279 story_runner.ProcessCommandLineArgs(parser, args) | 277 story_runner.ProcessCommandLineArgs(parser, args) |
OLD | NEW |