Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: tools/perf/page_sets/key_power_cases.py

Issue 1097463004: Add key_idle_power_cases for ensuring idle activity on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4 from page_sets import android_screen_restoration_shared_state
5
6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module
8
9
10 class KeyPowerPage(page_module.Page):
11
12 def __init__(self, url, page_set, turn_screen_off):
13 super(KeyPowerPage, self).__init__(
14 url=url,
15 page_set=page_set,
16 shared_page_state_class=(android_screen_restoration_shared_state
17 .AndroidScreenRestorationSharedState))
18 self.user_agent_type = 'mobile'
19 self._turn_screen_off = turn_screen_off
20
21 def RunNavigateSteps(self, action_runner):
22 super(KeyPowerPage, self).RunNavigateSteps(action_runner)
23 action_runner.Wait(2)
24 if self._turn_screen_off:
25 action_runner._tab.browser.platform.android_action_runner.TurnScreenOff()
nednguyen 2015/04/27 17:47:49 This is an API violation. I am working enable a si
jdduke (slow) 2015/04/28 21:30:29 OK, how should we proceed? Wait on that?
nednguyen 2015/04/28 23:03:24 Yes. Or you can go ahead with this change and add
26 # We're not interested in tracking activity that occurs immediately after
27 # the screen is turned off. Several seconds should be enough time for the
28 # browser to "settle down" into an idle state.
29 action_runner.Wait(2)
30
31 def RunPageInteractions(self, action_runner):
32 # The page interaction is simply waiting in an idle state.
33 action_runner.Wait(20)
34
35
36 class KeyPowerCasesPageSet(page_set_module.PageSet):
37
38 """ Key power cases """
39
40 def __init__(self):
41 super(KeyPowerCasesPageSet, self).__init__(
42 user_agent_type='mobile')
43
44 foreground_urls_list = [
45 # Why: Ensure minimal activity for static, empty pages in the foreground.
46 'file://key_power_cases/blank.html',
47 ]
48
49 for url in foreground_urls_list:
50 self.AddUserStory(KeyPowerPage(url, self, False))
51
52 background_urls_list = [
53 # Why: Ensure animated GIFs aren't processed when Chrome is backgrounded.
54 'file://key_power_cases/animated-gif.html',
55 # Why: Ensure CSS animations aren't processed when Chrome is backgrounded.
56 'file://key_power_cases/css-animation.html',
57 # Why: Ensure rAF is suppressed when Chrome is backgrounded.
58 'file://key_power_cases/request-animation-frame.html',
59 # Why: Ensure setTimeout is throttled when Chrome is backgrounded.
60 'file://key_power_cases/set-timeout.html',
61 ]
62
63 for url in background_urls_list:
64 self.AddUserStory(KeyPowerPage(url, self, True))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698