Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / tools / perf / page_sets / tough_energy_cases.py
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
8
9
10 class ToughEnergyCasesPage(page_module.Page):
11
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'
16
17
18 class GmailPage(ToughEnergyCasesPage):
19
20   """ Why: productivity, top google properties """
21
22   def __init__(self, page_set):
23     super(GmailPage, self).__init__(
24       url='https://mail.google.com/mail/',
25       page_set=page_set)
26
27     self.credentials = 'google'
28
29   def RunNavigateSteps(self, action_runner):
30     action_runner.RunAction(NavigateAction())
31     action_runner.RunAction(WaitAction(
32       {
33         'javascript': (
34           'window.gmonkey !== undefined &&'
35           'document.getElementById("gb") !== null')
36       }))
37
38
39 class ToughEnergyCasesPageSet(page_set_module.PageSet):
40
41   """ Pages for measuring Chrome power draw. """
42
43   def __init__(self):
44     super(ToughEnergyCasesPageSet, self).__init__(
45       credentials_path='data/credentials.json',
46       archive_data_file='data/tough_energy_cases.json')
47
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',
51       self))
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',
56       self))
57     # Why: Below the fold flash animation
58     self.AddPage(ToughEnergyCasesPage(
59       'file://tough_energy_cases/below-fold-flash.html',
60       self))