| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from page_sets import repeatable_synthesize_scroll_gesture_shared_state | 5 from page_sets import repeatable_synthesize_scroll_gesture_shared_state |
| 6 | 6 |
| 7 from telemetry.core import util |
| 7 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
| 8 from telemetry import story | 9 from telemetry import story |
| 9 | 10 |
| 10 | 11 |
| 11 class SwiffyPage(page_module.Page): | 12 class SwiffyPage(page_module.Page): |
| 12 | 13 |
| 13 def __init__(self, url, page_set): | 14 def __init__(self, url, page_set): |
| 14 super(SwiffyPage, self).__init__(url=url, page_set=page_set, | 15 super(SwiffyPage, self).__init__(url=url, page_set=page_set, |
| 15 make_javascript_deterministic=False) | 16 make_javascript_deterministic=False) |
| 16 | 17 |
| 17 def RunNavigateSteps(self, action_runner): | 18 def RunNavigateSteps(self, action_runner): |
| 18 super(SwiffyPage, self).RunNavigateSteps(action_runner) | 19 super(SwiffyPage, self).RunNavigateSteps(action_runner) |
| 20 # Make sure the ad has finished loading. |
| 21 util.WaitFor(action_runner.tab.HasReachedQuiescence, 60) |
| 19 # Swiffy overwrites toString() to return a constant string, so "undo" that | 22 # Swiffy overwrites toString() to return a constant string, so "undo" that |
| 20 # here so that we don't think it has stomped over console.time. | 23 # here so that we don't think it has stomped over console.time. |
| 21 action_runner.EvaluateJavaScript( | 24 action_runner.EvaluateJavaScript( |
| 22 'Function.prototype.toString = function() { return "[native code]"; }') | 25 'Function.prototype.toString = function() { return "[native code]"; }') |
| 23 # Make sure we have a reasonable viewport for mobile. | 26 # Make sure we have a reasonable viewport for mobile. |
| 24 viewport_js = ( | 27 viewport_js = ( |
| 25 'var meta = document.createElement("meta");' | 28 'var meta = document.createElement("meta");' |
| 26 'meta.name = "viewport";' | 29 'meta.name = "viewport";' |
| 27 'meta.content = "width=device-width";' | 30 'meta.content = "width=device-width";' |
| 28 'document.getElementsByTagName("head")[0].appendChild(meta);') | 31 'document.getElementsByTagName("head")[0].appendChild(meta);') |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 self.AddStory(AdPage('http://androidpolice.com', self, scroll=scroll, | 207 self.AddStory(AdPage('http://androidpolice.com', self, scroll=scroll, |
| 205 wait_for_interactive_or_better=True)) | 208 wait_for_interactive_or_better=True)) |
| 206 | 209 |
| 207 | 210 |
| 208 class ScrollingToughAdCasesPageSet(ToughAdCasesPageSet): | 211 class ScrollingToughAdCasesPageSet(ToughAdCasesPageSet): |
| 209 """Pages for measuring scrolling performance with advertising content.""" | 212 """Pages for measuring scrolling performance with advertising content.""" |
| 210 | 213 |
| 211 def __init__(self): | 214 def __init__(self): |
| 212 super(ScrollingToughAdCasesPageSet, self).__init__( | 215 super(ScrollingToughAdCasesPageSet, self).__init__( |
| 213 scroll=True) | 216 scroll=True) |
| OLD | NEW |