Home | History | Annotate | Download | only in page_sets
      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 KeySearchMobilePage(page_module.Page):
      9 
     10   def __init__(self, url, page_set):
     11     super(KeySearchMobilePage, self).__init__(url=url, page_set=page_set)
     12     self.credentials_path = 'data/credentials.json'
     13     self.user_agent_type = 'mobile'
     14     self.archive_data_file = 'data/key_search_mobile.json'
     15 
     16   def RunSmoothness(self, action_runner):
     17     interaction = action_runner.BeginGestureInteraction(
     18         'ScrollAction', is_smooth=True)
     19     action_runner.ScrollPage()
     20     interaction.End()
     21 
     22 
     23 class KeySearchMobilePageSet(page_set_module.PageSet):
     24 
     25   """ Key mobile search queries on google """
     26 
     27   def __init__(self):
     28     super(KeySearchMobilePageSet, self).__init__(
     29       credentials_path='data/credentials.json',
     30       user_agent_type='mobile',
     31       archive_data_file='data/key_search_mobile.json',
     32       bucket=page_set_module.PUBLIC_BUCKET)
     33 
     34     urls_list = [
     35       # Why: An empty page should be as snappy as possible
     36       'http://www.google.com/',
     37       # Why: A reasonable search term with no images or ads usually
     38       'https://www.google.com/search?q=science',
     39       # Why: A reasonable search term with images but no ads usually
     40       'http://www.google.com/search?q=orange',
     41       # Why: An address search
     42       # pylint: disable=C0301
     43       'https://www.google.com/search?q=1600+Amphitheatre+Pkwy%2C+Mountain+View%2C+CA',
     44       # Why: A search for a known actor
     45       'http://www.google.com/search?q=tom+hanks',
     46       # Why: A search for weather
     47       'https://www.google.com/search?q=weather+94110',
     48       # Why: A search for a stock
     49       'http://www.google.com/search?q=goog',
     50       # Why: Charts
     51       'https://www.google.com/search?q=population+of+california',
     52       # Why: Flights
     53       'http://www.google.com/search?q=sfo+jfk+flights',
     54       # Why: Movie showtimes
     55       'https://www.google.com/search?q=movies+94110',
     56       # Why: A tip calculator
     57       'http://www.google.com/search?q=tip+on+100+bill',
     58       # Why: Time
     59       'https://www.google.com/search?q=time+in+san+francisco',
     60       # Why: Definitions
     61       'http://www.google.com/search?q=define+define',
     62       # Why: Local results
     63       'https://www.google.com/search?q=burritos+94110',
     64       # Why: Graph
     65       'http://www.google.com/search?q=x^3'
     66     ]
     67 
     68     for url in urls_list:
     69       self.AddPage(KeySearchMobilePage(url, self))
     70