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.
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
):
18 super(AndroidScreenRestorationSharedState
, self
).DidRunStory(results
)
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')
28 def _EnsureScreenOn(self
):
29 self
.platform
.android_action_runner
.EnsureScreenOn()