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