OLD | NEW |
(Empty) | |
| 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 from telemetry.page import page as page_module |
| 5 from telemetry.page import page_set as page_set_module |
| 6 |
| 7 class KeyPowerPage(page_module.Page): |
| 8 |
| 9 def __init__(self, url, page_set, turn_screen_off): |
| 10 super(KeyPowerPage, self).__init__( |
| 11 url=url, page_set=page_set) |
| 12 self.user_agent_type = 'mobile' |
| 13 self._turn_screen_off = turn_screen_off |
| 14 |
| 15 def RunNavigateSteps(self, action_runner): |
| 16 action_runner._tab.browser.platform.android_action_runner.TurnScreenOn() |
| 17 super(KeyPowerPage, self).RunNavigateSteps(action_runner) |
| 18 action_runner.Wait(2) |
| 19 if self._turn_screen_off: |
| 20 action_runner._tab.browser.platform.android_action_runner.TurnScreenOff() |
| 21 action_runner.Wait(2) |
| 22 |
| 23 def RunPageInteractions(self, action_runner): |
| 24 action_runner.Wait(20) |
| 25 |
| 26 |
| 27 class KeyPowerCasesPageSet(page_set_module.PageSet): |
| 28 |
| 29 """ Key power cases """ |
| 30 |
| 31 def __init__(self): |
| 32 super(KeyPowerCasesPageSet, self).__init__( |
| 33 user_agent_type='mobile') |
| 34 |
| 35 foreground_urls_list = [ |
| 36 # Why: Ensure minimal activity for static, empty pages in the foreground. |
| 37 'file://key_power_cases/blank.html', |
| 38 ] |
| 39 |
| 40 for url in foreground_urls_list: |
| 41 self.AddUserStory(KeyPowerPage(url, self, False)) |
| 42 |
| 43 background_urls_list = [ |
| 44 # Why: Ensure animated GIFs aren't processed when Chrome is backgrounded. |
| 45 'file://key_power_cases/animated-gif.html', |
| 46 # Why: Ensure CSS animations aren't processed when Chrome is backgrounded. |
| 47 'file://key_power_cases/css-animation.html', |
| 48 # Why: Ensure rAF is suppressed when Chrome is backgrounded. |
| 49 'file://key_power_cases/request-animation-frame.html', |
| 50 # Why: Ensure setTimeout is throttled when Chrome is backgrounded. |
| 51 'file://key_power_cases/set-timeout.html', |
| 52 ] |
| 53 |
| 54 for url in background_urls_list: |
| 55 self.AddUserStory(KeyPowerPage(url, self, True)) |
OLD | NEW |