Chromium Code Reviews| 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 itertools | 8 import itertools |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 self.suite_path = os.path.join( | 36 self.suite_path = os.path.join( |
| 37 constants.GetOutDirectory(), '%s_apk' % suite_name, | 37 constants.GetOutDirectory(), '%s_apk' % suite_name, |
| 38 '%s-debug.apk' % suite_name) | 38 '%s-debug.apk' % suite_name) |
| 39 if suite_name == 'content_browsertests': | 39 if suite_name == 'content_browsertests': |
| 40 self._package_info = constants.PACKAGE_INFO['content_browsertests'] | 40 self._package_info = constants.PACKAGE_INFO['content_browsertests'] |
| 41 elif suite_name == 'components_browsertests': | 41 elif suite_name == 'components_browsertests': |
| 42 self._package_info = constants.PACKAGE_INFO['components_browsertests'] | 42 self._package_info = constants.PACKAGE_INFO['components_browsertests'] |
| 43 else: | 43 else: |
| 44 self._package_info = constants.PACKAGE_INFO['gtest'] | 44 self._package_info = constants.PACKAGE_INFO['gtest'] |
| 45 | 45 |
| 46 if suite_name == 'net_unittests': | |
| 47 self._extras = {'RunInSubThread': ''} | |
|
Fabrice (no longer in Chrome)
2015/07/31 13:20:29
This has been making the Android/asan bot fail sin
| |
| 48 else: | |
| 49 self._extras = [] | |
| 50 | |
| 46 def _CreateCommandLineFileOnDevice(self, device, options): | 51 def _CreateCommandLineFileOnDevice(self, device, options): |
| 47 device.WriteFile(self._package_info.cmdline_file, | 52 device.WriteFile(self._package_info.cmdline_file, |
| 48 self.suite_name + ' ' + options) | 53 self.suite_name + ' ' + options) |
| 49 | 54 |
| 50 def _GetFifo(self): | 55 def _GetFifo(self): |
| 51 # The test.fifo path is determined by: | 56 # The test.fifo path is determined by: |
| 52 # testing/android/native_test/java/src/org/chromium/native_test/ | 57 # testing/android/native_test/java/src/org/chromium/native_test/ |
| 53 # NativeTestActivity.java and | 58 # NativeTestActivity.java and |
| 54 # testing/android/native_test_launcher.cc | 59 # testing/android/native_test_launcher.cc |
| 55 return '/data/data/' + self._package_info.package + '/files/test.fifo' | 60 return '/data/data/' + self._package_info.package + '/files/test.fifo' |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 67 raise device_errors.DeviceUnreachableError( | 72 raise device_errors.DeviceUnreachableError( |
| 68 'Unable to find fifo on device %s ' % self._GetFifo()) | 73 'Unable to find fifo on device %s ' % self._GetFifo()) |
| 69 args = shlex.split(device.old_interface.Adb()._target_arg) | 74 args = shlex.split(device.old_interface.Adb()._target_arg) |
| 70 args += ['shell', 'cat', self._GetFifo()] | 75 args += ['shell', 'cat', self._GetFifo()] |
| 71 return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) | 76 return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) |
| 72 | 77 |
| 73 def _StartActivity(self, device, force_stop=True): | 78 def _StartActivity(self, device, force_stop=True): |
| 74 device.StartActivity( | 79 device.StartActivity( |
| 75 intent.Intent(package=self._package_info.package, | 80 intent.Intent(package=self._package_info.package, |
| 76 activity=self._package_info.activity, | 81 activity=self._package_info.activity, |
| 77 action='android.intent.action.MAIN'), | 82 action='android.intent.action.MAIN', |
| 83 extras=self._extras), | |
| 78 # No wait since the runner waits for FIFO creation anyway. | 84 # No wait since the runner waits for FIFO creation anyway. |
| 79 blocking=False, | 85 blocking=False, |
| 80 force_stop=force_stop) | 86 force_stop=force_stop) |
| 81 | 87 |
| 82 #override | 88 #override |
| 83 def ClearApplicationState(self, device): | 89 def ClearApplicationState(self, device): |
| 84 device.ClearApplicationState(self._package_info.package) | 90 device.ClearApplicationState(self._package_info.package) |
| 85 # Content shell creates a profile on the sdscard which accumulates cache | 91 # Content shell creates a profile on the sdscard which accumulates cache |
| 86 # files over time. | 92 # files over time. |
| 87 if self.suite_name == 'content_browsertests': | 93 if self.suite_name == 'content_browsertests': |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 | 148 |
| 143 #override | 149 #override |
| 144 def Install(self, device): | 150 def Install(self, device): |
| 145 self.tool.CopyFiles(device) | 151 self.tool.CopyFiles(device) |
| 146 device.Install(self.suite_path) | 152 device.Install(self.suite_path) |
| 147 | 153 |
| 148 #override | 154 #override |
| 149 def PullAppFiles(self, device, files, directory): | 155 def PullAppFiles(self, device, files, directory): |
| 150 local_device_gtest_run.PullAppFilesImpl( | 156 local_device_gtest_run.PullAppFilesImpl( |
| 151 device, self._package_info.package, files, directory) | 157 device, self._package_info.package, files, directory) |
| OLD | NEW |