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 from telemetry.page import page as page_module 5 from telemetry.page import page_set as page_set_module 6 7 8 class SimplePage(page_module.Page): 9 10 def __init__(self, url, page_set): 11 super(SimplePage, self).__init__(url=url, page_set=page_set) 12 self.credentials_path = 'data/credentials.json' 13 self.archive_data_file = 'data/simple_mobile_sites.json' 14 15 def RunNavigateSteps(self, action_runner): 16 action_runner.NavigateToPage(self) 17 # TODO(epenner): Remove this wait (http://crbug.com/366933) 18 action_runner.Wait(5) 19 20 class SimpleScrollPage(SimplePage): 21 22 def __init__(self, url, page_set): 23 super(SimpleScrollPage, self).__init__(url=url, page_set=page_set) 24 25 def RunSmoothness(self, action_runner): 26 # Make the scroll longer to reduce noise. 27 interaction = action_runner.BeginGestureInteraction( 28 'ScrollAction', is_smooth=True) 29 action_runner.ScrollPage(direction='down', speed_in_pixels_per_second=300) 30 interaction.End() 31 32 class SimpleMobileSitesPageSet(page_set_module.PageSet): 33 34 """ Simple mobile sites """ 35 36 def __init__(self): 37 super(SimpleMobileSitesPageSet, self).__init__( 38 credentials_path='data/credentials.json', 39 user_agent_type='tablet_10_inch', 40 archive_data_file='data/simple_mobile_sites.json', 41 bucket=page_set_module.PUBLIC_BUCKET) 42 43 scroll_page_list = [ 44 # Why: Scrolls moderately complex pages (up to 60 layers) 45 'http://www.ebay.co.uk/', 46 'https://www.flickr.com/', 47 'http://www.apple.com/mac/', 48 'http://www.nyc.gov', 49 'http://m.nytimes.com/', 50 'https://www.yahoo.com/', 51 'http://m.us.wsj.com/', 52 ] 53 54 for url in scroll_page_list: 55 self.AddPage(SimpleScrollPage(url, self)) 56 57