OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Defines TestPackageApk to help run APK-based native tests.""" | 5 """Defines TestPackageApk to help run APK-based native tests.""" |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import shlex | 10 import shlex |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 class TestPackageApk(TestPackage): | 24 class TestPackageApk(TestPackage): |
25 """A helper class for running APK-based native tests.""" | 25 """A helper class for running APK-based native tests.""" |
26 | 26 |
27 def __init__(self, suite_name): | 27 def __init__(self, suite_name): |
28 """ | 28 """ |
29 Args: | 29 Args: |
30 suite_name: Name of the test suite (e.g. base_unittests). | 30 suite_name: Name of the test suite (e.g. base_unittests). |
31 """ | 31 """ |
32 TestPackage.__init__(self, suite_name) | 32 TestPackage.__init__(self, suite_name) |
| 33 self.suite_path = os.path.join( |
| 34 constants.GetOutDirectory(), '%s_apk' % suite_name, |
| 35 '%s-debug.apk' % suite_name) |
33 if suite_name == 'content_browsertests': | 36 if suite_name == 'content_browsertests': |
34 self.suite_path = os.path.join( | |
35 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name) | |
36 self._package_info = constants.PACKAGE_INFO['content_browsertests'] | 37 self._package_info = constants.PACKAGE_INFO['content_browsertests'] |
37 elif suite_name == 'components_browsertests': | 38 elif suite_name == 'components_browsertests': |
38 self.suite_path = os.path.join( | |
39 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name) | |
40 self._package_info = constants.PACKAGE_INFO['components_browsertests'] | 39 self._package_info = constants.PACKAGE_INFO['components_browsertests'] |
41 else: | 40 else: |
42 self.suite_path = os.path.join( | |
43 constants.GetOutDirectory(), '%s_apk' % suite_name, | |
44 '%s-debug.apk' % suite_name) | |
45 self._package_info = constants.PACKAGE_INFO['gtest'] | 41 self._package_info = constants.PACKAGE_INFO['gtest'] |
46 | 42 |
47 def _CreateCommandLineFileOnDevice(self, device, options): | 43 def _CreateCommandLineFileOnDevice(self, device, options): |
48 device.WriteFile(self._package_info.cmdline_file, | 44 device.WriteFile(self._package_info.cmdline_file, |
49 self.suite_name + ' ' + options) | 45 self.suite_name + ' ' + options) |
50 | 46 |
51 def _GetFifo(self): | 47 def _GetFifo(self): |
52 # The test.fifo path is determined by: | 48 # The test.fifo path is determined by: |
53 # testing/android/native_test/java/src/org/chromium/native_test/ | 49 # testing/android/native_test/java/src/org/chromium/native_test/ |
54 # NativeTestActivity.java and | 50 # NativeTestActivity.java and |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 self._StartActivity(device, force_stop=False) | 134 self._StartActivity(device, force_stop=False) |
139 finally: | 135 finally: |
140 self.tool.CleanUpEnvironment() | 136 self.tool.CleanUpEnvironment() |
141 logfile = android_commands.NewLineNormalizer(sys.stdout) | 137 logfile = android_commands.NewLineNormalizer(sys.stdout) |
142 return self._WatchFifo(device, timeout=10, logfile=logfile) | 138 return self._WatchFifo(device, timeout=10, logfile=logfile) |
143 | 139 |
144 #override | 140 #override |
145 def Install(self, device): | 141 def Install(self, device): |
146 self.tool.CopyFiles(device) | 142 self.tool.CopyFiles(device) |
147 device.Install(self.suite_path) | 143 device.Install(self.suite_path) |
OLD | NEW |