Minor Python style clean-up
[chromium-blink-merge.git] / tools / chrome_proxy / integration_tests / chrome_proxy_pagesets / safebrowsing.py
blob5c47806c12d0867b02132eea37d8b796b23fc410
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import logging
6 from telemetry.core import exceptions
7 from telemetry.page import page as page_module
8 from telemetry import story
11 class SafebrowsingPage(page_module.Page):
13 """
14 Why: Expect 'malware ahead' page. Use a short navigation timeout because no
15 response will be received.
16 """
18 def __init__(self, url, page_set, expect_timeout):
19 super(SafebrowsingPage, self).__init__(url=url, page_set=page_set)
20 self._expect_timeout = expect_timeout
22 def RunNavigateSteps(self, action_runner):
23 try:
24 action_runner.Navigate(self.url, timeout_in_seconds=5)
25 except exceptions.TimeoutException as e:
26 if self._expect_timeout:
27 logging.warning('Navigation timeout on page %s', self.url)
28 else:
29 raise e
32 class SafebrowsingStorySet(story.StorySet):
34 """ Chrome proxy test sites """
36 def __init__(self, expect_timeout=False):
37 super(SafebrowsingStorySet, self).__init__()
39 self.AddStory(
40 SafebrowsingPage('http://www.ianfette.org/', self, expect_timeout))