Commit 701f20c5 authored by nednguyen's avatar nednguyen Committed by Commit bot

Remove Page.CanRunOnBrowser hook

BUG=468085

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

Cr-Commit-Position: refs/heads/master@{#321520}
parent e450ffd9
......@@ -110,17 +110,6 @@ class Page(user_story.UserStory):
"""
pass
# Deprecated. Do not use this hook. (crbug.com/468085)
def CanRunOnBrowser(self, browser_info):
"""Override this to returns whether this page can be run on specific
browser.
Args:
browser_info: an instance of telemetry.core.browser_info.BrowserInfo
"""
assert browser_info
return True
def AsDict(self):
"""Converts a page object to a dict suitable for JSON output."""
d = {
......
......@@ -414,31 +414,29 @@ class PageRunEndToEndTests(unittest.TestCase):
user_story_runner.Run(test, ps, expectations, options, results)
assert test.did_call_clean_up
# Ensure skipping the test if page cannot be run on the browser
def testPageCannotRunOnBrowser(self):
# Ensure skipping the test if shared state cannot be run on the browser.
def testSharedPageStateCannotRunOnBrowser(self):
ps = page_set.PageSet()
expectations = test_expectations.TestExpectations()
class PageThatCannotRunOnBrowser(page_module.Page):
def __init__(self):
super(PageThatCannotRunOnBrowser, self).__init__(
url='file://blank.html', page_set=ps,
base_dir=util.GetUnittestDataDir())
class UnrunnableSharedState(shared_page_state.SharedPageState):
def CanRunOnBrowser(self, _):
return False
def ValidateAndMeasurePage(self, _):
pass
ps.AddUserStory(page_module.Page(
url='file://blank.html', page_set=ps,
base_dir=util.GetUnittestDataDir(),
shared_page_state_class=UnrunnableSharedState))
expectations = test_expectations.TestExpectations()
class Test(page_test.PageTest):
def __init__(self, *args, **kwargs):
super(Test, self).__init__(*args, **kwargs)
self.will_navigate_to_page_called = False
def ValidateAndMeasurePage(self, *args):
pass
def ValidateAndMeasurePage(self, *_args):
raise Exception('Exception should not be thrown')
def WillNavigateToPage(self, _1, _2):
self.will_navigate_to_page_called = True
......@@ -451,7 +449,8 @@ class PageRunEndToEndTests(unittest.TestCase):
results = results_options.CreateResults(EmptyMetadataForTest(), options)
user_story_runner.Run(test, ps, expectations, options, results)
self.assertFalse(test.will_navigate_to_page_called)
self.assertEquals(0, len(GetSuccessfulPageRuns(results)))
self.assertEquals(1, len(GetSuccessfulPageRuns(results)))
self.assertEquals(1, len(results.skipped_values))
self.assertEquals(0, len(results.failures))
def testRunPageWithProfilingFlag(self):
......
......@@ -205,15 +205,6 @@ class SharedPageState(shared_user_story_state.SharedUserStoryState):
'Skipped because browser is not supported '
'(page.CanRunOnBrowser() returns False).')
return 'skip', skip_value
#TODO(nednguyen): Remove this code block when page.CanRunOnBrowser hook is
# removed. (crbug.com/468085)
if not self._current_page.CanRunOnBrowser(
browser_info_module.BrowserInfo(self.browser)):
skip_value = skip.SkipValue(
self._current_page,
'Skipped because browser is not supported '
'(page.CanRunOnBrowser() returns False).')
return 'skip', skip_value
expectation = expectations.GetExpectationForPage(
self.browser, self._current_page)
if expectation == 'skip':
......
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