exclude PluginsFieldTrialTest.NoPrefLeftBehind from valgrind bot
[chromium-blink-merge.git] / tools / perf / page_sets / android_screen_restoration_shared_state.py
blob73b4243c49ce13959b0fe1158089c2e8743bd9b4
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 import logging
6 from telemetry.page import shared_page_state
9 class AndroidScreenRestorationSharedState(shared_page_state.SharedPageState):
10 """ Ensures the screen is on before and after each user story is run. """
12 def WillRunStory(self, page):
13 super(AndroidScreenRestorationSharedState, self).WillRunStory(page)
14 self._EnsureScreenOn()
16 def DidRunStory(self, results):
17 try:
18 super(AndroidScreenRestorationSharedState, self).DidRunStory(results)
19 finally:
20 self._EnsureScreenOn()
22 def CanRunOnBrowser(self, browser_info, _):
23 if not browser_info.browser_type.startswith('android'):
24 logging.warning('Browser is non-Android, skipping test')
25 return False
26 return True
28 def _EnsureScreenOn(self):
29 self.platform.android_action_runner.EnsureScreenOn()