1 # Copyright (c) 2013 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.
5 """Class representing instrumentation test apk and jar."""
9 from pylib
.instrumentation
import test_jar
10 from pylib
.utils
import apk_helper
13 class TestPackage(test_jar
.TestJar
):
14 def __init__(self
, apk_path
, jar_path
, test_support_apk_path
):
15 test_jar
.TestJar
.__init
__(self
, jar_path
)
17 if not os
.path
.exists(apk_path
):
18 raise Exception('%s not found, please build it' % apk_path
)
19 self
._apk
_path
= apk_path
20 self
._apk
_name
= os
.path
.splitext(os
.path
.basename(apk_path
))[0]
21 self
._package
_name
= apk_helper
.GetPackageName(self
._apk
_path
)
22 self
._test
_support
_apk
_path
= test_support_apk_path
25 """Returns the absolute path to the APK."""
29 """Returns the name of the apk without the suffix."""
32 def GetPackageName(self
):
33 """Returns the package name of this APK."""
34 return self
._package
_name
37 def Install(self
, device
):
38 device
.Install(self
.GetApkPath())
39 if (self
._test
_support
_apk
_path
and
40 os
.path
.exists(self
._test
_support
_apk
_path
)):
41 device
.Install(self
._test
_support
_apk
_path
)