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 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import shlex | 8 import shlex |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 self._ClearFifo() | 115 self._ClearFifo() |
116 self._StartActivity() | 116 self._StartActivity() |
117 finally: | 117 finally: |
118 self.tool.CleanUpEnvironment() | 118 self.tool.CleanUpEnvironment() |
119 logfile = android_commands.NewLineNormalizer(sys.stdout) | 119 logfile = android_commands.NewLineNormalizer(sys.stdout) |
120 return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile)) | 120 return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile)) |
121 | 121 |
122 def _NeedsInstall(self): | 122 def _NeedsInstall(self): |
123 installed_apk_path = self.adb.GetApplicationPath(self._apk_package_name) | 123 installed_apk_path = self.adb.GetApplicationPath(self._apk_package_name) |
124 if installed_apk_path: | 124 if installed_apk_path: |
125 return not self.adb.CheckMd5Sum( | 125 return not self.adb.CheckTimesModified( |
126 self.test_suite_full, installed_apk_path, ignore_paths=True) | 126 self.test_suite_full, installed_apk_path, ignore_paths=True) |
127 else: | 127 else: |
128 return True | 128 return True |
129 | 129 |
130 def StripAndCopyExecutable(self): | 130 def StripAndCopyExecutable(self): |
131 self.tool.CopyFiles() | 131 self.tool.CopyFiles() |
132 if self._NeedsInstall(): | 132 if self._NeedsInstall(): |
133 # Always uninstall the previous one (by activity name); we don't | 133 # Always uninstall the previous one (by activity name); we don't |
134 # know what was embedded in it. | 134 # know what was embedded in it. |
135 self.adb.ManagedInstall(self.test_suite_full, False, | 135 self.adb.ManagedInstall(self.test_suite_full, False, |
136 package_name=self._apk_package_name) | 136 package_name=self._apk_package_name) |
137 | 137 |
138 def _GetTestSuiteBaseName(self): | 138 def _GetTestSuiteBaseName(self): |
139 """Returns the base name of the test suite.""" | 139 """Returns the base name of the test suite.""" |
140 # APK test suite names end with '-debug.apk' | 140 # APK test suite names end with '-debug.apk' |
141 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 141 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] |
OLD | NEW |