| Index: tools/telemetry/telemetry/benchmark.py
|
| diff --git a/tools/telemetry/telemetry/benchmark.py b/tools/telemetry/telemetry/benchmark.py
|
| index 7763ede0d2d0df0626f51bbc68da55d7e3c0dd07..3c20e1cd99de65c8d71c90e14c5da87107819bc6 100644
|
| --- a/tools/telemetry/telemetry/benchmark.py
|
| +++ b/tools/telemetry/telemetry/benchmark.py
|
| @@ -55,13 +55,16 @@
|
|
|
| @classmethod
|
| def AddCommandLineArgs(cls, parser):
|
| - if hasattr(cls, 'AddBenchmarkCommandLineArgs'):
|
| + cls.PageTestClass().AddCommandLineArgs(parser)
|
| +
|
| + if hasattr(cls, 'AddTestCommandLineArgs'):
|
| group = optparse.OptionGroup(parser, '%s test options' % cls.Name())
|
| - cls.AddBenchmarkCommandLineArgs(group)
|
| + cls.AddTestCommandLineArgs(group)
|
| parser.add_option_group(group)
|
|
|
| @classmethod
|
| def SetArgumentDefaults(cls, parser):
|
| + cls.PageTestClass().SetArgumentDefaults(parser)
|
| default_values = parser.get_default_values()
|
| invalid_options = [
|
| o for o in cls.options if not hasattr(default_values, o)]
|
| @@ -72,7 +75,7 @@
|
|
|
| @classmethod
|
| def ProcessCommandLineArgs(cls, parser, args):
|
| - pass
|
| + cls.PageTestClass().ProcessCommandLineArgs(parser, args)
|
|
|
| def CustomizeBrowserOptions(self, options):
|
| """Add browser options that are required by this benchmark."""
|
| @@ -84,7 +87,7 @@
|
| """Run this test with the given options."""
|
| self.CustomizeBrowserOptions(finder_options.browser_options)
|
|
|
| - pt = self.CreatePageTest(finder_options)
|
| + pt = self.PageTestClass()()
|
| pt.__name__ = self.__class__.__name__
|
|
|
| if hasattr(self, '_disabled_strings'):
|
| @@ -175,17 +178,17 @@
|
| extracted_profile_dir_path)
|
| options.browser_options.profile_dir = extracted_profile_dir_path
|
|
|
| - def CreatePageTest(self, options): # pylint: disable=W0613
|
| + @classmethod
|
| + def PageTestClass(cls):
|
| """Get the PageTest for this Benchmark.
|
|
|
| - By default, it will create a page test from the test's test attribute.
|
| - Override to generate a custom page test.
|
| + If the Benchmark has no PageTest, raises NotImplementedError.
|
| """
|
| - if not hasattr(self, 'test'):
|
| + if not hasattr(cls, 'test'):
|
| raise NotImplementedError('This test has no "test" attribute.')
|
| - if not issubclass(self.test, page_test.PageTest):
|
| - raise TypeError('"%s" is not a PageTest.' % self.test.__name__)
|
| - return self.test()
|
| + if not issubclass(cls.test, page_test.PageTest):
|
| + raise TypeError('"%s" is not a PageTest.' % cls.test.__name__)
|
| + return cls.test
|
|
|
| def CreatePageSet(self, options): # pylint: disable=W0613
|
| """Get the page set this test will run on.
|
|
|