OLD | NEW |
(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 import logging |
| 5 |
| 6 from telemetry.page import shared_page_state |
| 7 |
| 8 |
| 9 class AndroidScreenRestorationSharedState(shared_page_state.SharedPageState): |
| 10 """ Ensures the screen is on before and after each user story is run. """ |
| 11 |
| 12 def WillRunUserStory(self, page): |
| 13 super(AndroidScreenRestorationSharedState, self).WillRunUserStory(page) |
| 14 self._EnsureScreenOn() |
| 15 |
| 16 def DidRunUserStory(self, results): |
| 17 try: |
| 18 super(AndroidScreenRestorationSharedState, self).DidRunUserStory(results) |
| 19 finally: |
| 20 self._EnsureScreenOn() |
| 21 |
| 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 |
| 27 |
| 28 def _EnsureScreenOn(self): |
| 29 self.platform.android_action_runner.EnsureScreenOn() |
OLD | NEW |