Commit 60c3db53 authored by nednguyen's avatar nednguyen Committed by Commit bot

Kill page_test.NavigateToPage

BUG=455391, 470147

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

Cr-Commit-Position: refs/heads/master@{#330623}
parent 90ad13a3
......@@ -19,8 +19,6 @@ class ChromeProxyValidation(page_test.PageTest):
needs_browser_restart_after_each_page=restart_after_each_page)
self._metrics = metrics
self._page = None
# Whether a timeout exception is expected during the test.
self._expect_timeout = False
def CustomizeBrowserOptions(self, options):
# Enable the chrome proxy (data reduction proxy).
......@@ -49,17 +47,3 @@ class ChromeProxyValidation(page_test.PageTest):
if hasattr(page, 'restart_after') and page.restart_after:
return True
return False
def RunNavigateSteps(self, page, tab):
# The redirect from safebrowsing causes a timeout. Ignore that.
try:
super(ChromeProxyValidation, self).RunNavigateSteps(page, tab)
if self._expect_timeout:
raise metrics.ChromeProxyMetricException, (
'Timeout was expected, but did not occur')
except exceptions.TimeoutException as e:
if self._expect_timeout:
logging.warning('Navigation timeout on page %s',
page.name if page.name else page.url)
else:
raise e
......@@ -89,7 +89,12 @@ class ChromeProxyBlockOnce(ChromeProxyBenchmark):
class ChromeProxySafeBrowsingOn(ChromeProxyBenchmark):
tag = 'safebrowsing_on'
test = measurements.ChromeProxySafebrowsingOn
page_set = pagesets.SafebrowsingPageSet
# Override CreateUserStorySet so that we can instantiate SafebrowsingPageSet
# with a non default param.
def CreateUserStorySet(self, options):
del options # unused
return pagesets.SafebrowsingPageSet(expect_timeout=True)
@classmethod
def Name(cls):
......
......@@ -113,10 +113,6 @@ class ChromeProxySafebrowsingOn(ChromeProxyValidation):
super(ChromeProxySafebrowsingOn, self).__init__(
metrics=metrics.ChromeProxyMetric())
def WillNavigateToPage(self, page, tab):
super(ChromeProxySafebrowsingOn, self).WillNavigateToPage(page, tab)
self._expect_timeout = True
def AddResults(self, tab, results):
self._metrics.AddResultsForSafebrowsingOn(tab, results)
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from telemetry.core import exceptions
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
......@@ -13,20 +15,28 @@ class SafebrowsingPage(page_module.Page):
response will be received.
"""
def __init__(self, url, page_set):
def __init__(self, url, page_set, expect_timeout):
super(SafebrowsingPage, self).__init__(url=url, page_set=page_set)
self.archive_data_file = '../data/chrome_proxy_safebrowsing.json'
self._expect_timeout = expect_timeout
def RunNavigateSteps(self, action_runner):
action_runner.Navigate(self.url, timeout_in_seconds=5)
try:
action_runner.Navigate(self.url, timeout_in_seconds=5)
except exceptions.TimeoutException as e:
if self._expect_timeout:
logging.warning('Navigation timeout on page %s', self.url)
else:
raise e
class SafebrowsingPageSet(page_set_module.PageSet):
""" Chrome proxy test sites """
def __init__(self):
def __init__(self, expect_timeout=False):
super(SafebrowsingPageSet, self).__init__(
archive_data_file='../data/chrome_proxy_safebrowsing.json')
self.AddUserStory(SafebrowsingPage('http://www.ianfette.org/', self))
self.AddUserStory(
SafebrowsingPage('http://www.ianfette.org/', self, expect_timeout))
......@@ -192,6 +192,7 @@ class PageTest(object):
"""
raise NotImplementedError
# Deprecated: do not use this hook. (crbug.com/470147)
def RunNavigateSteps(self, page, tab):
"""Navigates the tab to the page URL 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