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
10 class ToughEnergyCasesPage(page_module.Page):
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 self.archive_data_file = 'data/tough_energy_cases.json'
18 class GmailPage(ToughEnergyCasesPage):
20 """ Why: productivity, top google properties """
22 def __init__(self, page_set):
23 super(GmailPage, self).__init__(
24 url='https://mail.google.com/mail/',
27 self.credentials = 'google'
29 def RunNavigateSteps(self, action_runner):
30 action_runner.RunAction(NavigateAction())
31 action_runner.RunAction(WaitAction(
34 'window.gmonkey !== undefined &&'
35 'document.getElementById("gb") !== null')
39 class ToughEnergyCasesPageSet(page_set_module.PageSet):
41 """ Pages for measuring Chrome power draw. """
44 super(ToughEnergyCasesPageSet, self).__init__(
45 credentials_path='data/credentials.json',
46 archive_data_file='data/tough_energy_cases.json')
48 # Why: Above the fold animated gif running in the background
49 self.AddPage(ToughEnergyCasesPage(
50 'file://tough_energy_cases/above-fold-animated-gif.html',
52 self.AddPage(GmailPage(self))
53 # Why: Below the fold animated gif
54 self.AddPage(ToughEnergyCasesPage(
55 'file://tough_energy_cases/below-fold-animated-gif.html',
57 # Why: Below the fold flash animation
58 self.AddPage(ToughEnergyCasesPage(
59 'file://tough_energy_cases/below-fold-flash.html',