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 3# found in the LICENSE file. 4from telemetry.page import shared_page_state 5 6from page_sets.rendering import rendering_story 7from page_sets.rendering import story_tags 8 9 10class ToughImageDecodePage(rendering_story.RenderingStory): 11 ABSTRACT_STORY = True 12 TAGS = [story_tags.TOUGH_IMAGE_DECODE] 13 14 def __init__(self, 15 page_set, 16 shared_page_state_class=shared_page_state.SharedMobilePageState, 17 name_suffix='', 18 extra_browser_args=None): 19 super(ToughImageDecodePage, self).__init__( 20 page_set=page_set, 21 shared_page_state_class=shared_page_state_class, 22 name_suffix=name_suffix, 23 extra_browser_args=extra_browser_args) 24 25 def RunPageInteractions(self, action_runner): 26 action_runner.WaitForJavaScriptCondition( 27 'document.readyState === "complete"') 28 action_runner.ScrollPage(direction='down', speed_in_pixels_per_second=5000) 29 with action_runner.CreateGestureInteraction('ScrollAction'): 30 action_runner.ScrollPage(direction='up', speed_in_pixels_per_second=5000) 31 32 33class UnscaledImageDecodePage(ToughImageDecodePage): 34 BASE_NAME = 'cats_unscaled' 35 URL = 'http://localhost:9000/cats-unscaled.html' 36 37 38class ViewPortWidthImageDecodePage(ToughImageDecodePage): 39 BASE_NAME = 'cats_viewport_width' 40 URL = 'http://localhost:9000/cats-viewport-width.html' 41