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

Unified Diff: tools/telemetry/telemetry/benchmark.py

Issue 737403002: Revert of telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « tools/perf/measurements/thread_times_unittest.py ('k') | tools/telemetry/telemetry/page/page_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « tools/perf/measurements/thread_times_unittest.py ('k') | tools/telemetry/telemetry/page/page_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698