Commit a085d53d authored by nednguyen's avatar nednguyen Committed by Commit bot

[Telemetry] Kill page_test.RunPage.

This helps making sure that page.Page are the sole owner of defining the
interactions with the page.

BUG=455391, 470147

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

Cr-Commit-Position: refs/heads/master@{#330474}
parent 3e544f3c
......@@ -192,13 +192,6 @@ class PageTest(object):
"""
raise NotImplementedError
def RunPage(self, page, tab, results):
# Run actions.
action_runner = action_runner_module.ActionRunner(
tab, skip_waits=page.skip_waits)
page.RunPageInteractions(action_runner)
self.ValidateAndMeasurePage(page, tab, results)
def RunNavigateSteps(self, page, tab):
"""Navigates the tab to the page URL attribute.
......
......@@ -14,6 +14,7 @@ from telemetry.core import util
from telemetry.core import wpr_modes
from telemetry import decorators
from telemetry.page import page_test
from telemetry.page import action_runner as action_runner_module
from telemetry.story import shared_state
from telemetry.util import exception_formatter
from telemetry.util import file_handle
......@@ -258,7 +259,11 @@ class SharedPageState(shared_state.SharedState):
try:
self._PreparePage()
self._ImplicitPageNavigation()
self._test.RunPage(self._current_page, self._current_tab, results)
action_runner = action_runner_module.ActionRunner(
self._current_tab, skip_waits=self._current_page.skip_waits)
self._current_page.RunPageInteractions(action_runner)
self._test.ValidateAndMeasurePage(
self._current_page, self._current_tab, results)
except exceptions.Error:
if self._test.is_multi_tab_test:
# Avoid trying to recover from an unknown multi-tab state.
......
......@@ -44,6 +44,8 @@ class RecorderPageTest(page_test.PageTest):
def DidNavigateToPage(self, page, tab):
if self.page_test:
self.page_test.DidNavigateToPage(page, tab)
tab.WaitForDocumentReadyStateToBeComplete()
util.WaitFor(tab.HasReachedQuiescence, 30)
def CleanUpAfterPage(self, page, tab):
if self.page_test:
......@@ -53,16 +55,6 @@ class RecorderPageTest(page_test.PageTest):
if self.page_test:
self.page_test.ValidateAndMeasurePage(page, tab, results)
def RunPage(self, page, tab, results):
tab.WaitForDocumentReadyStateToBeComplete()
util.WaitFor(tab.HasReachedQuiescence, 30)
if self.page_test:
self.page_test.RunPage(page, tab, results)
return
super(RecorderPageTest, self).RunPage(page, tab, results)
def RunNavigateSteps(self, page, tab):
if self.page_test:
self.page_test.RunNavigateSteps(page, tab)
......
......@@ -100,24 +100,19 @@ class RecordWprUnitTests(tab_test_case.TabTestCase):
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)
# When the RecorderPageTest is created from a Benchmark, the benchmark will
# have a PageTest, specified by its test attribute.
def testRunPage_OnlyRunBenchmarkAction(self):
record_page_test = record_wpr.RecorderPageTest()
record_page_test.page_test = MockBenchmark().test()
page = MockPage(page_set=MockPageSet(url=self._url), url=self._url)
record_page_test.RunPage(page, self._tab, results=None)
self.assertTrue('RunPageInteractions' in page.func_calls)
self.assertFalse('RunSmoothness' in page.func_calls)
record_page_test.ValidateAndMeasurePage(page, self._tab, results=None)
def testRunPage_CallBenchmarksPageTestsFunctions(self):
record_page_test = record_wpr.RecorderPageTest()
record_page_test.page_test = MockBenchmark().test()
page = MockPage(page_set=MockPageSet(url=self._url), url=self._url)
record_page_test.RunPage(page, self._tab, results=None)
record_page_test.ValidateAndMeasurePage(page, self._tab, results=None)
self.assertEqual(1, len(record_page_test.page_test.func_calls))
self.assertEqual('ValidateAndMeasurePage',
record_page_test.page_test.func_calls[0])
......
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