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

Side by Side Diff: build/android/pylib/gtest/test_package_apk.py

Issue 14601004: [Android] Only reinstall test apk if needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 self.tool.SetupEnvironment() 108 self.tool.SetupEnvironment()
109 self._ClearFifo() 109 self._ClearFifo()
110 self.adb.RunShellCommand( 110 self.adb.RunShellCommand(
111 'am start -n ' + self._apk_package_name + '/' + 111 'am start -n ' + self._apk_package_name + '/' +
112 self._test_activity_name) 112 self._test_activity_name)
113 finally: 113 finally:
114 self.tool.CleanUpEnvironment() 114 self.tool.CleanUpEnvironment()
115 logfile = android_commands.NewLineNormalizer(sys.stdout) 115 logfile = android_commands.NewLineNormalizer(sys.stdout)
116 return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile)) 116 return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile))
117 117
118 def _NeedsInstall(self):
119 pm_path_output = self.adb.RunShellCommand(
120 'pm path ' + self._apk_package_name)
121 if not pm_path_output:
122 return True
123 # pm_path_output is of the form: "package:/path/to/foo.apk"
124 installed_apk_path = pm_path_output[0].split(':')[1]
125 return not self.adb.CheckMd5Sum(
126 self.test_suite_full, installed_apk_path, ignore_paths=True)
127
118 def StripAndCopyExecutable(self): 128 def StripAndCopyExecutable(self):
119 self.tool.CopyFiles() 129 self.tool.CopyFiles()
120 # Always uninstall the previous one (by activity name); we don't 130 if self._NeedsInstall():
121 # know what was embedded in it. 131 # Always uninstall the previous one (by activity name); we don't
122 self.adb.ManagedInstall(self.test_suite_full, False, 132 # know what was embedded in it.
123 package_name=self._apk_package_name) 133 self.adb.ManagedInstall(self.test_suite_full, False,
134 package_name=self._apk_package_name)
124 135
125 def _GetTestSuiteBaseName(self): 136 def _GetTestSuiteBaseName(self):
126 """Returns the base name of the test suite.""" 137 """Returns the base name of the test suite."""
127 # APK test suite names end with '-debug.apk' 138 # APK test suite names end with '-debug.apk'
128 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] 139 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0]
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698