| 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 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import shlex | 9 import shlex |
| 10 import sys | 10 import sys |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 self._test_activity_name, | 80 self._test_activity_name, |
| 81 wait_for_completion=True, | 81 wait_for_completion=True, |
| 82 action='android.intent.action.MAIN', | 82 action='android.intent.action.MAIN', |
| 83 force_stop=True) | 83 force_stop=True) |
| 84 | 84 |
| 85 def _NeedsInstall(self): | 85 def _NeedsInstall(self): |
| 86 installed_apk_path = self.adb.GetApplicationPath( | 86 installed_apk_path = self.adb.GetApplicationPath( |
| 87 self._test_apk_package_name) | 87 self._test_apk_package_name) |
| 88 if installed_apk_path: | 88 if installed_apk_path: |
| 89 return not self.adb.CheckMd5Sum( | 89 return not self.adb.CheckMd5Sum( |
| 90 self.test_suite_full, installed_apk_path, ignore_paths=True) | 90 self.test_suite_full, installed_apk_path) |
| 91 else: | 91 else: |
| 92 return True | 92 return True |
| 93 | 93 |
| 94 def _GetTestSuiteBaseName(self): | 94 def _GetTestSuiteBaseName(self): |
| 95 """Returns the base name of the test suite.""" | 95 """Returns the base name of the test suite.""" |
| 96 # APK test suite names end with '-debug.apk' | 96 # APK test suite names end with '-debug.apk' |
| 97 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 97 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] |
| 98 | 98 |
| 99 #override | 99 #override |
| 100 def ClearApplicationState(self): | 100 def ClearApplicationState(self): |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 #override | 137 #override |
| 138 def Install(self): | 138 def Install(self): |
| 139 self.tool.CopyFiles() | 139 self.tool.CopyFiles() |
| 140 if self._NeedsInstall(): | 140 if self._NeedsInstall(): |
| 141 # Always uninstall the previous one (by activity name); we don't | 141 # Always uninstall the previous one (by activity name); we don't |
| 142 # know what was embedded in it. | 142 # know what was embedded in it. |
| 143 self.adb.ManagedInstall(self.test_suite_full, False, | 143 self.adb.ManagedInstall(self.test_suite_full, False, |
| 144 package_name=self._test_apk_package_name) | 144 package_name=self._test_apk_package_name) |
| 145 | 145 |
| OLD | NEW |