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 # pylint: disable=W0401,W0614
      5 from telemetry.page.actions.all_page_actions import *
      6 from telemetry.page import page as page_module
      7 from telemetry.page import page_set as page_set_module
      8 
      9 
     10 class ToughEnergyCasesPage(page_module.Page):
     11 
     12   def __init__(self, url, page_set):
     13     super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set)
     14     self.credentials_path = 'data/credentials.json'
     15 
     16 
     17 class GmailPage(ToughEnergyCasesPage):
     18 
     19   """ Why: productivity, top google properties """
     20 
     21   def __init__(self, page_set):
     22     super(GmailPage, self).__init__(
     23       url='https://mail.google.com/mail/',
     24       page_set=page_set)
     25 
     26     self.credentials = 'google'
     27 
     28   def RunNavigateSteps(self, action_runner):
     29     action_runner.NavigateToPage(self)
     30     action_runner.WaitForJavaScriptCondition(
     31         'window.gmonkey !== undefined &&'
     32         'document.getElementById("gb") !== null')
     33 
     34 
     35 class ToughEnergyCasesPageSet(page_set_module.PageSet):
     36 
     37   """ Pages for measuring Chrome power draw. """
     38 
     39   def __init__(self):
     40     super(ToughEnergyCasesPageSet, self).__init__(
     41       archive_data_file='data/tough_energy_cases.json',
     42       bucket=page_set_module.PUBLIC_BUCKET,
     43       credentials_path='data/credentials.json')
     44 
     45     # Why: Above the fold animated gif running in the background
     46     self.AddPage(ToughEnergyCasesPage(
     47       'file://tough_energy_cases/above-fold-animated-gif.html',
     48       self))
     49     # TODO(dominikg): fix crbug.com/386152
     50     #self.AddPage(GmailPage(self))
     51     # Why: Below the fold animated gif
     52     self.AddPage(ToughEnergyCasesPage(
     53       'file://tough_energy_cases/below-fold-animated-gif.html',
     54       self))
     55     # Why: Below the fold flash animation
     56     self.AddPage(ToughEnergyCasesPage(
     57       'file://tough_energy_cases/below-fold-flash.html',
     58       self))
     59