Commit 93b48faf authored by nednguyen's avatar nednguyen Committed by Commit bot

Remove action_name_to_run field

BUG=418375

Review URL: https://codereview.chromium.org/1012483002

Cr-Commit-Position: refs/heads/master@{#320741}
parent a361faf2
......@@ -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
......@@ -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:
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment