Chromium Code Reviews| 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 74bab7dac8271dc23947c7ec1486f19b663b3952..968d0940e5598e02af4caa4081b23501bc0f11f4 100644 |
| --- a/tools/telemetry/telemetry/page/page_test.py |
| +++ b/tools/telemetry/telemetry/page/page_test.py |
| @@ -2,7 +2,6 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -from telemetry.core import command_line |
| from telemetry.page import test_expectations |
| from telemetry.page.actions import action_runner as action_runner_module |
| @@ -23,7 +22,7 @@ class MeasurementFailure(Failure): |
| designed-for problem.""" |
| -class PageTest(command_line.Command): |
| +class PageTest(object): |
| """A class styled on unittest.TestCase for creating page-specific tests. |
| Test should override ValidateAndMeasurePage to perform test |
| @@ -36,19 +35,6 @@ class PageTest(command_line.Command): |
| results.AddValue(scalar.ScalarValue( |
| page, 'body_children', 'count', body_child_count)) |
| - The class also provide hooks to add test-specific options. Here is |
| - an example: |
| - |
| - class BodyChildElementMeasurement(PageTest): |
| - def AddCommandLineArgs(parser): |
| - parser.add_option('--element', action='store', default='body') |
| - |
| - def ValidateAndMeasurePage(self, page, tab, results): |
| - body_child_count = tab.EvaluateJavaScript( |
| - 'document.querySelector('%s').children.length') |
| - results.AddValue(scalar.ScalarValue( |
| - page, 'children', 'count', child_count)) |
| - |
| Args: |
| action_name_to_run: This is the method name in telemetry.page.Page |
| subclasses to run. |
| @@ -66,8 +52,6 @@ class PageTest(command_line.Command): |
| will fail. |
| """ |
| - options = {} |
| - |
| def __init__(self, |
| action_name_to_run='', |
| needs_browser_restart_after_each_page=False, |
| @@ -78,7 +62,6 @@ class PageTest(command_line.Command): |
| is_action_name_to_run_optional=False): |
| super(PageTest, self).__init__() |
| - self.options = None |
| if action_name_to_run: |
| assert action_name_to_run.startswith('Run') \ |
| and '_' not in action_name_to_run, \ |
| @@ -104,10 +87,6 @@ class PageTest(command_line.Command): |
| # _exit_requested is set to true when the test requests an early exit. |
| self._exit_requested = False |
| - @classmethod |
| - def SetArgumentDefaults(cls, parser): |
| - parser.set_defaults(**cls.options) |
| - |
| @property |
| def discard_first_result(self): |
| """When set to True, the first run of the test is discarded. This is |
| @@ -205,16 +184,14 @@ class PageTest(command_line.Command): |
| return hasattr(page, self._action_name_to_run) |
| return True |
| - def WillRunTest(self, options): |
| + def WillRunTest(self): |
| """Override to do operations before the page set(s) are navigated.""" |
| - self.options = options |
| def DidRunTest(self, browser, results): # pylint: disable=W0613 |
| """Override to do operations after all page set(s) are completed. |
| This will occur before the browser is torn down. |
| """ |
| - self.options = None |
| def WillNavigateToPage(self, page, tab): |
| """Override to do operations before the page is navigated, notably Telemetry |
| @@ -287,14 +264,10 @@ class PageTest(command_line.Command): |
| def RunPage(self, page, tab, results): |
| # Run actions. |
| - interactive = self.options and self.options.interactive |
| action_runner = action_runner_module.ActionRunner( |
| tab, skip_waits=page.skip_waits) |
| self.WillRunActions(page, tab) |
| - if interactive: |
|
chrishenry
2014/10/15 18:26:09
Unclear to me whether you need to remove this. Can
ernstm
2014/10/16 22:32:13
Not strictly necessary. I added the feature back.
|
| - action_runner.PauseInteractive() |
| - else: |
| - self._RunMethod(page, self._action_name_to_run, action_runner) |
| + self._RunMethod(page, self._action_name_to_run, action_runner) |
| self.DidRunActions(page, tab) |
| self.ValidateAndMeasurePage(page, tab, results) |