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 from pylib.utils import apk_helper |
10 | 10 |
11 class UirobotTestInstance(test_instance.TestInstance): | 11 class UirobotTestInstance(test_instance.TestInstance): |
12 | 12 |
13 def __init__(self, args): | 13 def __init__(self, args, error_func): |
14 """Constructor. | 14 """Constructor. |
15 | 15 |
16 Args: | 16 Args: |
17 args: Command line arguments. | 17 args: Command line arguments. |
18 """ | 18 """ |
19 super(UirobotTestInstance, self).__init__() | 19 super(UirobotTestInstance, self).__init__() |
20 self._apk_under_test = os.path.join( | 20 if not args.app_under_test: |
21 constants.GetOutDirectory(), args.app_under_test) | 21 error_func('Must set --app-under-test.') |
| 22 self._app_under_test = args.app_under_test |
| 23 |
| 24 if args.device_type == 'Android': |
| 25 self._suite = 'Android Uirobot' |
| 26 self._package_name = apk_helper.GetPackageName(self._app_under_test) |
| 27 |
| 28 elif args.device_type == 'iOS': |
| 29 self._suite = 'iOS Uirobot' |
| 30 self._package_name = self._app_under_test |
| 31 |
22 self._minutes = args.minutes | 32 self._minutes = args.minutes |
23 self._package_name = apk_helper.GetPackageName(self._apk_under_test) | |
24 self._suite = 'Android Uirobot' | |
25 | 33 |
26 #override | 34 #override |
27 def TestType(self): | 35 def TestType(self): |
28 """Returns type of test.""" | 36 """Returns type of test.""" |
29 return 'uirobot' | 37 return 'uirobot' |
30 | 38 |
31 #override | 39 #override |
32 def SetUp(self): | 40 def SetUp(self): |
33 """Setup for test.""" | 41 """Setup for test.""" |
34 pass | 42 pass |
35 | 43 |
36 #override | 44 #override |
37 def TearDown(self): | 45 def TearDown(self): |
38 """Teardown for test.""" | 46 """Teardown for test.""" |
39 pass | 47 pass |
40 | 48 |
41 @property | 49 @property |
42 def apk_under_test(self): | 50 def app_under_test(self): |
43 """Returns the app to run the test on.""" | 51 """Returns the app to run the test on.""" |
44 return self._apk_under_test | 52 return self._app_under_test |
45 | 53 |
46 @property | 54 @property |
47 def minutes(self): | 55 def minutes(self): |
48 """Returns the number of minutes to run the uirobot for.""" | 56 """Returns the number of minutes to run the uirobot for.""" |
49 return self._minutes | 57 return self._minutes |
50 | 58 |
51 @property | 59 @property |
52 def package_name(self): | 60 def package_name(self): |
53 """Returns the name of the package in the APK.""" | 61 """Returns the name of the package in the APK.""" |
54 return self._package_name | 62 return self._package_name |
55 | 63 |
56 @property | 64 @property |
57 def suite(self): | 65 def suite(self): |
58 return self._suite | 66 return self._suite |
OLD | NEW |