Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 1570043004: Adds --skip-clear-data flag to android's test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update todo Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if not results: 222 if not results:
223 return 223 return
224 if results.DidRunPass(): 224 if results.DidRunPass():
225 self.TearDownPerfMonitoring(test) 225 self.TearDownPerfMonitoring(test)
226 226
227 if self.coverage_dir: 227 if self.coverage_dir:
228 self.device.PullFile( 228 self.device.PullFile(
229 self.coverage_device_file, self.coverage_host_file) 229 self.coverage_device_file, self.coverage_host_file)
230 self.device.RunShellCommand( 230 self.device.RunShellCommand(
231 'rm -f %s' % self.coverage_device_file) 231 'rm -f %s' % self.coverage_device_file)
232 elif self.package_info: 232 elif self.package_info and not self.options.skip_clear_data:
233 apk_under_test = self.test_pkg.GetApkUnderTest() 233 apk_under_test = self.test_pkg.GetApkUnderTest()
234 permissions = apk_under_test.GetPermissions() if apk_under_test else None 234 permissions = apk_under_test.GetPermissions() if apk_under_test else None
235 self.device.ClearApplicationState( 235 self.device.ClearApplicationState(
236 self.package_info.package, permissions=permissions) 236 self.package_info.package, permissions=permissions)
237 self.device.ClearApplicationState(self.package_info.package)
237 238
238 def TearDownPerfMonitoring(self, test): 239 def TearDownPerfMonitoring(self, test):
239 """Cleans up performance monitoring if the specified test required it. 240 """Cleans up performance monitoring if the specified test required it.
240 241
241 Args: 242 Args:
242 test: The name of the test that was just run. 243 test: The name of the test that was just run.
243 Raises: 244 Raises:
244 Exception: if there's anything wrong with the perf data. 245 Exception: if there's anything wrong with the perf data.
245 """ 246 """
246 if not self._IsPerfTest(test): 247 if not self._IsPerfTest(test):
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 result_name, ' '.join(flag_modifiers.add)) 416 result_name, ' '.join(flag_modifiers.add))
416 if flag_modifiers.remove: 417 if flag_modifiers.remove:
417 result_name = '%s without {%s}' % ( 418 result_name = '%s without {%s}' % (
418 result_name, ' '.join(flag_modifiers.remove)) 419 result_name, ' '.join(flag_modifiers.remove))
419 result.SetName(result_name) 420 result.SetName(result_name)
420 results.AddResult(result) 421 results.AddResult(result)
421 422
422 self.TestTeardown(test, results) 423 self.TestTeardown(test, results)
423 424
424 return (results, None if results.DidRunPass() else test) 425 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/test_options.py ('k') | build/android/pylib/local/device/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698