OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 from pylib import constants | 7 from pylib import constants |
8 from pylib.base import test_instance | 8 from pylib.base import test_instance |
| 9 from pylib.utils import apk_helper |
9 | 10 |
10 class UirobotTestInstance(test_instance.TestInstance): | 11 class UirobotTestInstance(test_instance.TestInstance): |
11 | 12 |
12 def __init__(self, args): | 13 def __init__(self, args): |
13 """Constructor. | 14 """Constructor. |
14 | 15 |
15 Args: | 16 Args: |
16 args: Command line arguments. | 17 args: Command line arguments. |
17 """ | 18 """ |
18 super(UirobotTestInstance, self).__init__() | 19 super(UirobotTestInstance, self).__init__() |
19 self._apk_under_test = os.path.join( | 20 self._apk_under_test = os.path.join( |
20 constants.GetOutDirectory(), args.apk_under_test) | 21 constants.GetOutDirectory(), args.apk_under_test) |
21 self._minutes = args.minutes | 22 self._minutes = args.minutes |
| 23 self._package_name = apk_helper.GetPackageName(self._apk_under_test) |
22 | 24 |
23 #override | 25 #override |
24 def TestType(self): | 26 def TestType(self): |
25 """Returns type of test.""" | 27 """Returns type of test.""" |
26 return 'uirobot' | 28 return 'uirobot' |
27 | 29 |
28 #override | 30 #override |
29 def SetUp(self): | 31 def SetUp(self): |
30 """Setup for test.""" | 32 """Setup for test.""" |
31 pass | 33 pass |
32 | 34 |
33 #override | 35 #override |
34 def TearDown(self): | 36 def TearDown(self): |
35 """Teardown for test.""" | 37 """Teardown for test.""" |
36 pass | 38 pass |
37 | 39 |
38 @property | 40 @property |
39 def apk_under_test(self): | 41 def apk_under_test(self): |
40 """Returns the app to run the test on.""" | 42 """Returns the app to run the test on.""" |
41 return self._apk_under_test | 43 return self._apk_under_test |
42 | 44 |
43 @property | 45 @property |
44 def suite(self): | |
45 """Returns the test suite, none for uirobot.""" | |
46 return None | |
47 | |
48 @property | |
49 def minutes(self): | 46 def minutes(self): |
50 """Returns the number of minutes to run the uirobot for.""" | 47 """Returns the number of minutes to run the uirobot for.""" |
51 return self._minutes | 48 return self._minutes |
| 49 |
| 50 @property |
| 51 def package_name(self): |
| 52 """Returns the name of the package in the APK.""" |
| 53 return self._package_name |
OLD | NEW |