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