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 """Class for running instrumentation tests on a single device.""" | 5 """Class for running instrumentation tests on a single device.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 if self.coverage_dir: | 237 if self.coverage_dir: |
238 self.device.PullFile( | 238 self.device.PullFile( |
239 self.coverage_device_file, self.coverage_host_file) | 239 self.coverage_device_file, self.coverage_host_file) |
240 self.device.RunShellCommand( | 240 self.device.RunShellCommand( |
241 'rm -f %s' % self.coverage_device_file) | 241 'rm -f %s' % self.coverage_device_file) |
242 elif self.package_info and not self.options.skip_clear_data: | 242 elif self.package_info and not self.options.skip_clear_data: |
243 apk_under_test = self.test_pkg.GetApkUnderTest() | 243 apk_under_test = self.test_pkg.GetApkUnderTest() |
244 permissions = apk_under_test.GetPermissions() if apk_under_test else None | 244 permissions = apk_under_test.GetPermissions() if apk_under_test else None |
245 self.device.ClearApplicationState( | 245 self.device.ClearApplicationState( |
246 self.package_info.package, permissions=permissions) | 246 self.package_info.package, permissions=permissions) |
247 self.device.ClearApplicationState(self.package_info.package) | |
248 | 247 |
249 def TearDownPerfMonitoring(self, test): | 248 def TearDownPerfMonitoring(self, test): |
250 """Cleans up performance monitoring if the specified test required it. | 249 """Cleans up performance monitoring if the specified test required it. |
251 | 250 |
252 Args: | 251 Args: |
253 test: The name of the test that was just run. | 252 test: The name of the test that was just run. |
254 Raises: | 253 Raises: |
255 Exception: if there's anything wrong with the perf data. | 254 Exception: if there's anything wrong with the perf data. |
256 """ | 255 """ |
257 if not self._IsPerfTest(test): | 256 if not self._IsPerfTest(test): |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 result_name, ' '.join(flag_modifiers.add)) | 425 result_name, ' '.join(flag_modifiers.add)) |
427 if flag_modifiers.remove: | 426 if flag_modifiers.remove: |
428 result_name = '%s without {%s}' % ( | 427 result_name = '%s without {%s}' % ( |
429 result_name, ' '.join(flag_modifiers.remove)) | 428 result_name, ' '.join(flag_modifiers.remove)) |
430 result.SetName(result_name) | 429 result.SetName(result_name) |
431 results.AddResult(result) | 430 results.AddResult(result) |
432 | 431 |
433 self.TestTeardown(test, results) | 432 self.TestTeardown(test, results) |
434 | 433 |
435 return (results, None if results.DidRunPass() else test) | 434 return (results, None if results.DidRunPass() else test) |
OLD | NEW |