summaryrefslogtreecommitdiffstats
path: root/tools/perf/page_sets/tough_energy_cases.py
blob: e5b148666cae1d2a56a6c3d996f30771a58d7533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module


class ToughEnergyCasesPage(page_module.Page):

  def __init__(self, url, page_set):
    super(ToughEnergyCasesPage, self).__init__(url=url, page_set=page_set)
    self.credentials_path = 'data/credentials.json'


class GmailPage(ToughEnergyCasesPage):

  """ Why: productivity, top google properties """

  def __init__(self, page_set):
    super(GmailPage, self).__init__(
      url='https://mail.google.com/mail/',
      page_set=page_set)

    self.credentials = 'google'

  def RunNavigateSteps(self, action_runner):
    action_runner.NavigateToPage(self)
    action_runner.WaitForJavaScriptCondition(
        'window.gmonkey !== undefined &&'
        'document.getElementById("gb") !== null')


class ToughEnergyCasesPageSet(page_set_module.PageSet):

  """ Pages for measuring Chrome power draw. """

  def __init__(self):
    super(ToughEnergyCasesPageSet, self).__init__(
      credentials_path='data/credentials.json')

    # Why: Above the fold animated gif running in the background
    self.AddPage(ToughEnergyCasesPage(
      'file://tough_energy_cases/above-fold-animated-gif.html',
      self))
    self.AddPage(GmailPage(self))
    # Why: Below the fold animated gif
    self.AddPage(ToughEnergyCasesPage(
      'file://tough_energy_cases/below-fold-animated-gif.html',
      self))
    # Why: Below the fold flash animation
    self.AddPage(ToughEnergyCasesPage(
      'file://tough_energy_cases/below-fold-flash.html',
      self))