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 ToughEnergyCasesPage(page_module.Page):
      9 
     10   def __init__(self, url, page_set):
     11     super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set)
     12     self.credentials_path = 'data/credentials.json'
     13 
     14 class CodePenPage(ToughEnergyCasesPage):
     15 
     16   def __init__(self, url, page_set):
     17     super(CodePenPage, self).__init__(url, page_set)
     18     self.credentials = 'codepen'
     19 
     20 
     21 class GooglePage(ToughEnergyCasesPage):
     22 
     23   def __init__(self, url, page_set):
     24     super(GooglePage, self).__init__(
     25         url=url,
     26         page_set=page_set)
     27     self.credentials = 'google'
     28 
     29   def RunNavigateSteps(self, action_runner):
     30     action_runner.NavigateToPage(self)
     31     action_runner.WaitForJavaScriptCondition(
     32         'window.gmonkey !== undefined &&'
     33         'document.getElementById("gb") !== null')
     34 
     35 
     36 class ToughEnergyCasesPageSet(page_set_module.PageSet):
     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: productivity, top google properties
     46     self.AddPage(GooglePage('https://mail.google.com/mail/', self))
     47 
     48     # Disabled: pegs CPU too much to get meaningful results.
     49     # Why: Image constantly changed in the background, above the fold
     50     # self.AddPage(CodePenPage(
     51     #     'http://codepen.io/testificate364/debug/eIutG', self))
     52 
     53     # Disabled: pegs CPU too much to get meaningful results.
     54     # Why: Image constantly changed in the background, below the fold
     55     # self.AddPage(CodePenPage(
     56     #     'http://codepen.io/testificate364/debug/zcDdv', self))
     57 
     58     # Why: CSS Animation, above the fold
     59     self.AddPage(CodePenPage(
     60          'http://codepen.io/testificate364/debug/nrbDc', self))
     61 
     62     # Why: CSS Animation, below the fold
     63     self.AddPage(CodePenPage(
     64         'http://codepen.io/testificate364/debug/fhKCg', self))
     65 
     66     # Why: requestAnimationFrame, above the fold
     67     self.AddPage(CodePenPage(
     68         'http://codepen.io/testificate364/debug/paJhg',self))
     69 
     70     # Why: requestAnimationFrame, below the fold
     71     self.AddPage(CodePenPage(
     72         'http://codepen.io/testificate364/debug/yaosK', self))
     73 
     74     # Why: setTimeout animation, above the fold
     75     self.AddPage(CodePenPage(
     76         'http://codepen.io/testificate364/debug/DLbxg', self))
     77 
     78     # Why: setTimeout animation, below the fold
     79     self.AddPage(CodePenPage(
     80         'http://codepen.io/testificate364/debug/kFvpd', self))
     81 
     82     # Why: setInterval animation, above the fold
     83     self.AddPage(CodePenPage(
     84         'http://codepen.io/testificate364/debug/lEhyw', self))
     85 
     86     # Why: setInterval animation, below the fold
     87     self.AddPage(CodePenPage(
     88         'http://codepen.io/testificate364/debug/zhgBD', self))
     89 
     90     # Why: Animated GIF, above the fold
     91     self.AddPage(CodePenPage(
     92         'http://codepen.io/testificate364/debug/jetyn', self))
     93 
     94     # Why: Animated GIF, below the fold
     95     self.AddPage(CodePenPage(
     96         'http://codepen.io/testificate364/debug/Kvdxs', self))
     97 
     98     # Why: HTML5 video, above the fold
     99     self.AddPage(CodePenPage(
    100         'http://codepen.io/testificate364/debug/lJAiH', self))
    101 
    102     # Why: HTML5 video, below the fold
    103     self.AddPage(CodePenPage(
    104         'http://codepen.io/testificate364/debug/EFceH', self))
    105 
    106     # Disabled: pegs CPU too much to get meaningful results.
    107     # Why: PostMessage between frames, above the fold
    108     # self.AddPage(CodePenPage(
    109     #    'http://codepen.io/testificate364/debug/pgBHu', self))
    110 
    111     # Disabled: pegs CPU too much to get meaningful results.
    112     # Why: Asynchronous XHR continually running
    113     # self.AddPage(CodePenPage(
    114     # 'http://codepen.io/testificate364/debug/iwAfJ', self))
    115 
    116     # Disabled: pegs CPU too much to get meaningful results.
    117     # Why: Web Worker continually running
    118     # self.AddPage(CodePenPage(
    119     #     'http://codepen.io/testificate364/debug/ckItK', self))
    120 
    121     # Why: flash video
    122     self.AddPage(CodePenPage(
    123         'http://codepen.io/testificate364/debug/slBue', self))
    124 
    125     # Why: Blank page in the foreground
    126     self.AddPage(CodePenPage(
    127         'http://codepen.io/testificate364/debug/HdIgr', self))
    128