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

Unified Diff: tools/telemetry/telemetry/page/page_test.py

Issue 22981005: [telemetry] Move Results options out of PageTest/Measurement into their own module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and lint. Created 7 years, 4 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
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | tools/telemetry/telemetry/page/page_test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page_test.py
diff --git a/tools/telemetry/telemetry/page/page_test.py b/tools/telemetry/telemetry/page/page_test.py
index a0fdc0bad03bb872ad3490454e0af825344fdcb5..e9d7147664b9fea315e8463b82b582fef4072b47 100644
--- a/tools/telemetry/telemetry/page/page_test.py
+++ b/tools/telemetry/telemetry/page/page_test.py
@@ -4,13 +4,12 @@
import logging
from telemetry.core import util
-from telemetry.page import gtest_test_results
from telemetry.page import test_expectations
-from telemetry.page import page_test_results
from telemetry.page.actions import all_page_actions
from telemetry.page.actions import navigate
from telemetry.page.actions import page_action
+
def _GetActionFromData(action_data):
action_name = action_data['action']
action = all_page_actions.FindClassWithName(action_name)
@@ -21,6 +20,7 @@ def _GetActionFromData(action_data):
raise Exception('Action "%s" not found.' % action_name)
return action(action_data)
+
def GetCompoundActionFromPage(page, action_name):
if not action_name:
return []
@@ -39,11 +39,13 @@ def GetCompoundActionFromPage(page, action_name):
action_list += subaction * subaction_data.get('repeat', 1)
return action_list
+
class Failure(Exception):
"""Exception that can be thrown from PageMeasurement to indicate an
undesired but designed-for problem."""
pass
+
class PageTest(object):
"""A class styled on unittest.TestCase for creating page-specific tests."""
@@ -167,32 +169,6 @@ class PageTest(object):
any that may have been defined in the page set."""
return test_expectations.TestExpectations()
- def AddOutputOptions(self, parser):
- parser.add_option('--output-format',
- default=self.output_format_choices[0],
- choices=self.output_format_choices,
- help='Output format. Defaults to "%%default". '
- 'Can be %s.' % ', '.join(self.output_format_choices))
-
- @property
- def output_format_choices(self):
- """Allowed output formats. The default is the first item in the list."""
- return ['gtest', 'none']
-
- def PrepareResults(self, options):
- if not hasattr(options, 'output_format'):
- options.output_format = self.output_format_choices[0]
-
- if options.output_format == 'gtest':
- return gtest_test_results.GTestTestResults()
- elif options.output_format == 'none':
- return page_test_results.PageTestResults()
- else:
- # Should never be reached. The parser enforces the choices.
- raise Exception('Invalid --output-format "%s". Valid choices are: %s'
- % (options.output_format,
- ', '.join(self.output_format_choices)))
-
def Run(self, options, page, tab, results):
self.options = options
compound_action = GetCompoundActionFromPage(page, self._action_name_to_run)
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | tools/telemetry/telemetry/page/page_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698