Update sdk/platform-tools to version 26.0.0.
[android_tools.git] / sdk / platform-tools / systrace / catapult / telemetry / telemetry / internal / app / __init__.py
blob0a1d389af979adce23837687a0c9a928e746cf27
1 # Copyright 2012 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 class App(object):
7 """ A running application instance that can be controlled in a limited way.
9 Be sure to clean up after yourself by calling Close() when you are done with
10 the app. Or better yet:
11 with possible_app.Create(options) as app:
12 ... do all your operations on app here
13 """
14 def __init__(self, app_backend, platform_backend):
15 assert platform_backend.platform != None
16 self._app_backend = app_backend
17 self._platform_backend = platform_backend
18 self._app_backend.SetApp(self)
20 @property
21 def app_type(self):
22 return self._app_backend.app_type
24 @property
25 def platform(self):
26 return self._platform_backend.platform
28 def __enter__(self):
29 return self
31 def __exit__(self, *args):
32 self.Close()
34 def Close(self):
35 raise NotImplementedError()
37 def GetStandardOutput(self):
38 return self._app_backend.GetStandardOutput()
40 def GetStackTrace(self):
41 return self._app_backend.GetStackTrace()
43 def GetMostRecentMinidumpPath(self):
44 return self._app_backend.GetMostRecentMinidumpPath()