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