OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from page_sets import android_screen_restoration_shared_state | 4 from page_sets import android_screen_restoration_shared_state |
5 | 5 from telemetry import story |
| 6 from telemetry.page import page as page_module |
6 from telemetry.page import shared_page_state | 7 from telemetry.page import shared_page_state |
7 from telemetry.page import page as page_module | |
8 from telemetry.page import page_set as page_set_module | |
9 | 8 |
10 | 9 |
11 class KeyIdlePowerPage(page_module.Page): | 10 class KeyIdlePowerPage(page_module.Page): |
12 | 11 |
13 def __init__(self, url, page_set, turn_screen_off, | 12 def __init__(self, url, page_set, turn_screen_off, |
14 shared_page_state_class=shared_page_state.SharedMobilePageState): | 13 shared_page_state_class=shared_page_state.SharedMobilePageState): |
15 super(KeyIdlePowerPage, self).__init__( | 14 super(KeyIdlePowerPage, self).__init__( |
16 url=url, | 15 url=url, |
17 page_set=page_set, | 16 page_set=page_set, |
18 shared_page_state_class=(android_screen_restoration_shared_state | 17 shared_page_state_class=(android_screen_restoration_shared_state |
(...skipping 12 matching lines...) Expand all Loading... |
31 # the screen is turned off. Several seconds should be enough time for the | 30 # the screen is turned off. Several seconds should be enough time for the |
32 # browser to "settle down" into an idle state. | 31 # browser to "settle down" into an idle state. |
33 action_runner.Wait(2) | 32 action_runner.Wait(2) |
34 | 33 |
35 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
36 # The page interaction is simply waiting in an idle state. | 35 # The page interaction is simply waiting in an idle state. |
37 with action_runner.CreateInteraction('IdleWaiting'): | 36 with action_runner.CreateInteraction('IdleWaiting'): |
38 action_runner.Wait(20) | 37 action_runner.Wait(20) |
39 | 38 |
40 | 39 |
41 class KeyIdlePowerCasesPageSet(page_set_module.PageSet): | 40 class KeyIdlePowerCasesPageSet(story.StorySet): |
42 | 41 |
43 """ Key idle power cases """ | 42 """ Key idle power cases """ |
44 | 43 |
45 def __init__(self): | 44 def __init__(self): |
46 super(KeyIdlePowerCasesPageSet, self).__init__() | 45 super(KeyIdlePowerCasesPageSet, self).__init__() |
47 | 46 |
48 foreground_urls_list = [ | 47 foreground_urls_list = [ |
49 # Why: Ensure minimal activity for static, empty pages in the foreground. | 48 # Why: Ensure minimal activity for static, empty pages in the foreground. |
50 'file://key_idle_power_cases/blank.html', | 49 'file://key_idle_power_cases/blank.html', |
51 ] | 50 ] |
52 | 51 |
53 for url in foreground_urls_list: | 52 for url in foreground_urls_list: |
54 self.AddUserStory(KeyIdlePowerPage(url, self, False)) | 53 self.AddUserStory(KeyIdlePowerPage(url, self, False)) |
55 | 54 |
56 background_urls_list = [ | 55 background_urls_list = [ |
57 # Why: Ensure animated GIFs aren't processed when Chrome is backgrounded. | 56 # Why: Ensure animated GIFs aren't processed when Chrome is backgrounded. |
58 'file://key_idle_power_cases/animated-gif.html', | 57 'file://key_idle_power_cases/animated-gif.html', |
59 # Why: Ensure CSS animations aren't processed when Chrome is backgrounded. | 58 # Why: Ensure CSS animations aren't processed when Chrome is backgrounded. |
60 'file://key_idle_power_cases/css-animation.html', | 59 'file://key_idle_power_cases/css-animation.html', |
61 # Why: Ensure rAF is suppressed when Chrome is backgrounded. | 60 # Why: Ensure rAF is suppressed when Chrome is backgrounded. |
62 'file://key_idle_power_cases/request-animation-frame.html', | 61 'file://key_idle_power_cases/request-animation-frame.html', |
63 # Why: Ensure setTimeout is throttled when Chrome is backgrounded. | 62 # Why: Ensure setTimeout is throttled when Chrome is backgrounded. |
64 'file://key_idle_power_cases/set-timeout.html', | 63 'file://key_idle_power_cases/set-timeout.html', |
65 ] | 64 ] |
66 | 65 |
67 for url in background_urls_list: | 66 for url in background_urls_list: |
68 self.AddUserStory(KeyIdlePowerPage(url, self, True)) | 67 self.AddUserStory(KeyIdlePowerPage(url, self, True)) |
OLD | NEW |