OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
6 | 6 |
7 | 7 |
8 class ToughEnergyCasesPage(page_module.Page): | 8 class ToughEnergyCasesPage(page_module.Page): |
9 | 9 |
10 def __init__(self, url, page_set): | 10 def __init__(self, url, page_set): |
11 super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set) | 11 super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set) |
12 self.credentials_path = 'data/credentials.json' | 12 self.credentials_path = 'data/credentials.json' |
13 | 13 |
| 14 class CodePenPage(ToughEnergyCasesPage): |
14 | 15 |
15 class GmailPage(ToughEnergyCasesPage): | 16 def __init__(self, url, page_set): |
| 17 super(CodePenPage, self).__init__(url, page_set) |
| 18 self.credentials = 'codepen' |
16 | 19 |
17 """ Why: productivity, top google properties """ | |
18 | 20 |
19 def __init__(self, page_set): | 21 class GooglePage(ToughEnergyCasesPage): |
20 super(GmailPage, self).__init__( | |
21 url='https://mail.google.com/mail/', | |
22 page_set=page_set) | |
23 | 22 |
| 23 def __init__(self, url, page_set): |
| 24 super(GooglePage, self).__init__( |
| 25 url=url, |
| 26 page_set=page_set) |
24 self.credentials = 'google' | 27 self.credentials = 'google' |
25 | 28 |
26 def RunNavigateSteps(self, action_runner): | 29 def RunNavigateSteps(self, action_runner): |
27 action_runner.NavigateToPage(self) | 30 action_runner.NavigateToPage(self) |
28 action_runner.WaitForJavaScriptCondition( | 31 action_runner.WaitForJavaScriptCondition( |
29 'window.gmonkey !== undefined &&' | 32 'window.gmonkey !== undefined &&' |
30 'document.getElementById("gb") !== null') | 33 'document.getElementById("gb") !== null') |
31 | 34 |
32 | 35 |
33 class ToughEnergyCasesPageSet(page_set_module.PageSet): | 36 class ToughEnergyCasesPageSet(page_set_module.PageSet): |
34 | 37 """Pages for measuring Chrome power draw.""" |
35 """ Pages for measuring Chrome power draw. """ | |
36 | 38 |
37 def __init__(self): | 39 def __init__(self): |
38 super(ToughEnergyCasesPageSet, self).__init__( | 40 super(ToughEnergyCasesPageSet, self).__init__( |
39 archive_data_file='data/tough_energy_cases.json', | 41 archive_data_file='data/tough_energy_cases.json', |
40 bucket=page_set_module.PUBLIC_BUCKET, | 42 bucket=page_set_module.PUBLIC_BUCKET, |
41 credentials_path='data/credentials.json') | 43 credentials_path='data/credentials.json') |
42 | 44 |
43 # Why: Above the fold animated gif running in the background | 45 # Why: productivity, top google properties |
44 self.AddPage(ToughEnergyCasesPage( | 46 self.AddPage(GooglePage('https://mail.google.com/mail/', self)) |
45 'file://tough_energy_cases/above-fold-animated-gif.html', | 47 |
46 self)) | 48 # Why: Image constantly changed in the background, above the fold |
47 # TODO(dominikg): fix crbug.com/386152 | 49 self.AddPage(CodePenPage( |
48 #self.AddPage(GmailPage(self)) | 50 'http://codepen.io/testificate364/debug/eIutG', self)) |
49 # Why: Below the fold animated gif | 51 |
50 self.AddPage(ToughEnergyCasesPage( | 52 # Why: Image constantly changed in the background, below the fold |
51 'file://tough_energy_cases/below-fold-animated-gif.html', | 53 self.AddPage(CodePenPage( |
52 self)) | 54 'http://codepen.io/testificate364/debug/zcDdv', self)) |
53 # Why: Below the fold flash animation | 55 |
54 self.AddPage(ToughEnergyCasesPage( | 56 # Why: CSS Animation, above the fold |
55 'file://tough_energy_cases/below-fold-flash.html', | 57 self.AddPage(CodePenPage( |
56 self)) | 58 'http://codepen.io/testificate364/debug/nrbDc', self)) |
| 59 |
| 60 # Why: CSS Animation, below the fold |
| 61 self.AddPage(CodePenPage( |
| 62 'http://codepen.io/testificate364/debug/fhKCg', self)) |
| 63 |
| 64 # Why: requestAnimationFrame, above the fold |
| 65 self.AddPage(CodePenPage( |
| 66 'http://codepen.io/testificate364/debug/paJhg',self)) |
| 67 |
| 68 # Why: requestAnimationFrame, below the fold |
| 69 self.AddPage(CodePenPage( |
| 70 'http://codepen.io/testificate364/debug/yaosK', self)) |
| 71 |
| 72 # Why: setTimeout animation, above the fold |
| 73 self.AddPage(CodePenPage( |
| 74 'http://codepen.io/testificate364/debug/DLbxg', self)) |
| 75 |
| 76 # Why: setTimeout animation, below the fold |
| 77 self.AddPage(CodePenPage( |
| 78 'http://codepen.io/testificate364/debug/kFvpd', self)) |
| 79 |
| 80 # Why: setInterval animation, above the fold |
| 81 self.AddPage(CodePenPage( |
| 82 'http://codepen.io/testificate364/debug/lEhyw', self)) |
| 83 |
| 84 # Why: setInterval animation, below the fold |
| 85 self.AddPage(CodePenPage( |
| 86 'http://codepen.io/testificate364/debug/zhgBD', self)) |
| 87 |
| 88 # Why: Animated GIF, above the fold |
| 89 self.AddPage(CodePenPage( |
| 90 'http://codepen.io/testificate364/debug/jetyn', self)) |
| 91 |
| 92 # Why: Animated GIF, below the fold |
| 93 self.AddPage(CodePenPage( |
| 94 'http://codepen.io/testificate364/debug/Kvdxs', self)) |
| 95 |
| 96 # Why: HTML5 video, above the fold |
| 97 self.AddPage(CodePenPage( |
| 98 'http://codepen.io/testificate364/debug/lJAiH', self)) |
| 99 |
| 100 # Why: HTML5 video, below the fold |
| 101 self.AddPage(CodePenPage( |
| 102 'http://codepen.io/testificate364/debug/EFceH', self)) |
| 103 |
| 104 # Why: PostMessage between frames, above the fold |
| 105 self.AddPage(CodePenPage( |
| 106 'http://codepen.io/testificate364/debug/pgBHu', self)) |
| 107 |
| 108 # Why: Asynchronous XHR continually running |
| 109 self.AddPage(CodePenPage( |
| 110 'http://codepen.io/testificate364/debug/iwAfJ', self)) |
| 111 |
| 112 # Why: Web Worker continually running |
| 113 self.AddPage(CodePenPage( |
| 114 'http://codepen.io/testificate364/debug/ckItK', self)) |
| 115 |
| 116 # Why: flash video |
| 117 self.AddPage(CodePenPage( |
| 118 'http://codepen.io/testificate364/debug/cFEaD', self)) |
| 119 |
| 120 # Why: Blank page in the foreground |
| 121 self.AddPage(CodePenPage( |
| 122 'http://codepen.io/testificate364/debug/HdIgr', self)) |
OLD | NEW |