| Index: tools/telemetry/telemetry/test.py
|
| diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py
|
| index 5f52affb9910e1c747bd5dc1b0d84e502f9fc860..10dc5cd47a58f8c7f0233ce6f9865d92bfd450c2 100644
|
| --- a/tools/telemetry/telemetry/test.py
|
| +++ b/tools/telemetry/telemetry/test.py
|
| @@ -38,7 +38,11 @@ class Test(command_line.Command):
|
| if hasattr(cls, 'tag'):
|
| name += '.' + cls.tag
|
| if hasattr(cls, 'page_set'):
|
| - name += '.' + os.path.basename(os.path.splitext(cls.page_set)[0])
|
| + if isinstance(cls.page_set, basestring):
|
| + # TODO(dtu): Remove this code path after crbug.com/362293.
|
| + name += '.' + os.path.basename(os.path.splitext(cls.page_set)[0])
|
| + else:
|
| + name += '.' + cls.page_set.Name()
|
| return name
|
|
|
| @classmethod
|
| @@ -164,16 +168,25 @@ class Test(command_line.Command):
|
| return cls.test
|
|
|
| @classmethod
|
| + def PageSetClass(cls):
|
| + """Get the PageSet for this Test.
|
| +
|
| + If the Test has no PageSet, raises NotImplementedError.
|
| + """
|
| + if not hasattr(cls, 'page_set'):
|
| + raise NotImplementedError('This test has no "page_set" attribute.')
|
| + if not issubclass(cls.page_set, page_set.PageSet):
|
| + raise TypeError('"%s" is not a PageSet.' % cls.page_set.__name__)
|
| + return cls.page_set
|
| +
|
| + @classmethod
|
| def CreatePageSet(cls, options): # pylint: disable=W0613
|
| """Get the page set this test will run on.
|
|
|
| By default, it will create a page set from the file at this test's
|
| page_set attribute. Override to generate a custom page set.
|
| """
|
| - if not hasattr(cls, 'page_set'):
|
| - raise NotImplementedError('This test has no "page_set" attribute.')
|
| - return page_set.PageSet.FromFile(
|
| - file_path=os.path.join(util.GetBaseDir(), cls.page_set))
|
| + return cls.PageSetClass()()
|
|
|
| @classmethod
|
| def CreateExpectations(cls, ps): # pylint: disable=W0613
|
|
|