From 93b48faf3cdfa9c6986333974baf37528f72d486 Mon Sep 17 00:00:00 2001 From: nednguyen Date: Mon, 16 Mar 2015 10:08:43 -0700 Subject: [PATCH] Remove action_name_to_run field BUG=418375 Review URL: https://codereview.chromium.org/1012483002 Cr-Commit-Position: refs/heads/master@{#320741} --- tools/telemetry/telemetry/page/page_test.py | 19 +------------------ tools/telemetry/telemetry/page/record_wpr.py | 19 +------------------ tools/telemetry/telemetry/page/record_wpr_unittest.py | 5 ++++- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/tools/telemetry/telemetry/page/page_test.py b/tools/telemetry/telemetry/page/page_test.py index 59104860aec1..8e297d14447a 100644 --- a/tools/telemetry/telemetry/page/page_test.py +++ b/tools/telemetry/telemetry/page/page_test.py @@ -43,24 +43,17 @@ class PageTest(object): page, 'body_children', 'count', body_child_count)) Args: - action_name_to_run: This is the method name in telemetry.page.Page - subclasses to run. discard_first_run: Discard the first run of this page. This is usually used with page_repeat and pageset_repeat options. """ def __init__(self, - action_name_to_run='RunPageInteractions', needs_browser_restart_after_each_page=False, discard_first_result=False, clear_cache_before_each_run=False): super(PageTest, self).__init__() self.options = None - assert action_name_to_run == 'RunPageInteractions', ( - 'action_name_to_run can only be \'RunPageInteractions\', see ' - 'crbug.com/418375') - self._action_name_to_run = action_name_to_run self._needs_browser_restart_after_each_page = ( needs_browser_restart_after_each_page) self._discard_first_result = discard_first_result @@ -221,16 +214,10 @@ class PageTest(object): if interactive: action_runner.PauseInteractive() else: - self._RunMethod(page, self._action_name_to_run, action_runner) + page.RunPageInteractions(action_runner) self.DidRunActions(page, tab) - self.ValidateAndMeasurePage(page, tab, results) - def _RunMethod(self, page, method_name, action_runner): - if hasattr(page, method_name): - run_method = getattr(page, method_name) - run_method(action_runner) - def RunNavigateSteps(self, page, tab): """Navigates the tab to the page URL attribute. @@ -239,7 +226,3 @@ class PageTest(object): action_runner = action_runner_module.ActionRunner( tab, skip_waits=page.skip_waits) page.RunNavigateSteps(action_runner) - - @property - def action_name_to_run(self): - return self._action_name_to_run diff --git a/tools/telemetry/telemetry/page/record_wpr.py b/tools/telemetry/telemetry/page/record_wpr.py index 12f4420502a9..39b90749ad75 100644 --- a/tools/telemetry/telemetry/page/record_wpr.py +++ b/tools/telemetry/telemetry/page/record_wpr.py @@ -16,11 +16,6 @@ from telemetry.page import test_expectations from telemetry.results import results_options from telemetry.user_story import user_story_runner -_ACTION_NAMES = [ - 'RunPageInteractions', - 'RunNavigateSteps', -] - class RecorderPageTest(page_test.PageTest): # pylint: disable=W0223 def __init__(self): super(RecorderPageTest, self).__init__() @@ -65,22 +60,10 @@ class RecorderPageTest(page_test.PageTest): # pylint: disable=W0223 util.WaitFor(tab.HasReachedQuiescence, 30) if self.page_test: - self._action_name_to_run = self.page_test.action_name_to_run self.page_test.RunPage(page, tab, results) return - should_reload = False - # Run the actions on the page for all available measurements. - for action_name in _ACTION_NAMES: - # Skip this action if it is not defined - if not hasattr(page, action_name): - continue - # Reload the page between actions to start with a clean slate. - if should_reload: - self.RunNavigateSteps(page, tab) - self._action_name_to_run = action_name - super(RecorderPageTest, self).RunPage(page, tab, results) - should_reload = True + super(RecorderPageTest, self).RunPage(page, tab, results) def RunNavigateSteps(self, page, tab): if self.page_test: diff --git a/tools/telemetry/telemetry/page/record_wpr_unittest.py b/tools/telemetry/telemetry/page/record_wpr_unittest.py index fcafadb2026a..cd38aeea6cc6 100644 --- a/tools/telemetry/telemetry/page/record_wpr_unittest.py +++ b/tools/telemetry/telemetry/page/record_wpr_unittest.py @@ -99,9 +99,12 @@ class RecordWprUnitTests(tab_test_case.TabTestCase): def testRunPage_AllActions(self): record_page_test = record_wpr.RecorderPageTest() page = MockPage(page_set=MockPageSet(url=self._url), url=self._url) + + record_page_test.RunNavigateSteps(page, self._tab) + self.assertTrue('RunNavigateSteps' in page.func_calls) + record_page_test.RunPage(page, self._tab, results=None) self.assertTrue('RunPageInteractions' in page.func_calls) - self.assertTrue('RunNavigateSteps' in page.func_calls) # When the RecorderPageTest is created from a Benchmark, the benchmark will # have a PageTest, specified by its test attribute. -- 2.11.4.GIT