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) | |
36 if suite_name == 'content_browsertests': | 33 if suite_name == 'content_browsertests': |
| 34 self.suite_path = os.path.join( |
| 35 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name) |
37 self._package_info = constants.PACKAGE_INFO['content_browsertests'] | 36 self._package_info = constants.PACKAGE_INFO['content_browsertests'] |
38 elif suite_name == 'components_browsertests': | 37 elif suite_name == 'components_browsertests': |
| 38 self.suite_path = os.path.join( |
| 39 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name) |
39 self._package_info = constants.PACKAGE_INFO['components_browsertests'] | 40 self._package_info = constants.PACKAGE_INFO['components_browsertests'] |
40 else: | 41 else: |
| 42 self.suite_path = os.path.join( |
| 43 constants.GetOutDirectory(), '%s_apk' % suite_name, |
| 44 '%s-debug.apk' % suite_name) |
41 self._package_info = constants.PACKAGE_INFO['gtest'] | 45 self._package_info = constants.PACKAGE_INFO['gtest'] |
42 | 46 |
43 def _CreateCommandLineFileOnDevice(self, device, options): | 47 def _CreateCommandLineFileOnDevice(self, device, options): |
44 device.WriteFile(self._package_info.cmdline_file, | 48 device.WriteFile(self._package_info.cmdline_file, |
45 self.suite_name + ' ' + options) | 49 self.suite_name + ' ' + options) |
46 | 50 |
47 def _GetFifo(self): | 51 def _GetFifo(self): |
48 # The test.fifo path is determined by: | 52 # The test.fifo path is determined by: |
49 # testing/android/native_test/java/src/org/chromium/native_test/ | 53 # testing/android/native_test/java/src/org/chromium/native_test/ |
50 # NativeTestActivity.java and | 54 # NativeTestActivity.java and |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 self._StartActivity(device, force_stop=False) | 138 self._StartActivity(device, force_stop=False) |
135 finally: | 139 finally: |
136 self.tool.CleanUpEnvironment() | 140 self.tool.CleanUpEnvironment() |
137 logfile = android_commands.NewLineNormalizer(sys.stdout) | 141 logfile = android_commands.NewLineNormalizer(sys.stdout) |
138 return self._WatchFifo(device, timeout=10, logfile=logfile) | 142 return self._WatchFifo(device, timeout=10, logfile=logfile) |
139 | 143 |
140 #override | 144 #override |
141 def Install(self, device): | 145 def Install(self, device): |
142 self.tool.CopyFiles(device) | 146 self.tool.CopyFiles(device) |
143 device.Install(self.suite_path) | 147 device.Install(self.suite_path) |
OLD | NEW |