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

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

Issue 637153002: telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/benchmark.py
diff --git a/tools/telemetry/telemetry/benchmark.py b/tools/telemetry/telemetry/benchmark.py
index bfdca6e76bed55a42554efd1242e0d496bfb12b5..be03815228d073af0ecafa430c7ef81c09bfa1b9 100644
--- a/tools/telemetry/telemetry/benchmark.py
+++ b/tools/telemetry/telemetry/benchmark.py
@@ -55,8 +55,6 @@ class Benchmark(command_line.Command):
@classmethod
def AddCommandLineArgs(cls, parser):
- cls.PageTestClass().AddCommandLineArgs(parser)
-
if hasattr(cls, 'AddTestCommandLineArgs'):
chrishenry 2014/10/15 18:26:09 Can you add a TODO to evaluate whether this is sti
ernstm 2014/10/16 22:32:12 AddTestCommandLineArgs nicely groups the options f
group = optparse.OptionGroup(parser, '%s test options' % cls.Name())
cls.AddTestCommandLineArgs(group)
@@ -64,7 +62,6 @@ class Benchmark(command_line.Command):
@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)]
@@ -75,7 +72,7 @@ class Benchmark(command_line.Command):
@classmethod
def ProcessCommandLineArgs(cls, parser, args):
- cls.PageTestClass().ProcessCommandLineArgs(parser, args)
+ pass
def CustomizeBrowserOptions(self, options):
"""Add browser options that are required by this benchmark."""
@@ -87,7 +84,7 @@ class Benchmark(command_line.Command):
"""Run this test with the given options."""
self.CustomizeBrowserOptions(finder_options.browser_options)
- pt = self.PageTestClass()()
+ pt = self.CreatePageTest(finder_options)
pt.__name__ = self.__class__.__name__
if hasattr(self, '_disabled_strings'):
@@ -173,17 +170,17 @@ class Benchmark(command_line.Command):
extracted_profile_dir_path)
options.browser_options.profile_dir = extracted_profile_dir_path
- @classmethod
- def PageTestClass(cls):
+ def CreatePageTest(self, options): # pylint: disable=W0613
"""Get the PageTest for this Benchmark.
- If the Benchmark has no PageTest, raises NotImplementedError.
+ By default, it will create a page test from the test's test attribute.
+ Override to generate a custom page test.
"""
- if not hasattr(cls, 'test'):
+ if not hasattr(self, 'test'):
raise NotImplementedError('This test has no "test" attribute.')
- if not issubclass(cls.test, page_test.PageTest):
- raise TypeError('"%s" is not a PageTest.' % cls.test.__name__)
- return cls.test
+ if not issubclass(self.test, page_test.PageTest):
+ raise TypeError('"%s" is not a PageTest.' % self.test.__name__)
+ return self.test()
def CreatePageSet(self, options): # pylint: disable=W0613
"""Get the page set this test will run on.

Powered by Google App Engine
This is Rietveld 408576698