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

Unified Diff: build/android/pylib/gtest/test_package_apk.py

Issue 839893004: Refactor test scripts for android to improve performance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Skip checking package on JBMR2 or above Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/gtest/test_package_apk.py
diff --git a/build/android/pylib/gtest/test_package_apk.py b/build/android/pylib/gtest/test_package_apk.py
index b4c67e650d6f8d72ee01646faaf83eba84e2b1e8..cdb6dafa1a906df72d022a567c40a6a6346f310a 100644
--- a/build/android/pylib/gtest/test_package_apk.py
+++ b/build/android/pylib/gtest/test_package_apk.py
@@ -55,11 +55,11 @@ class TestPackageApk(TestPackage):
device.RunShellCommand('rm -f ' + self._GetFifo())
def _WatchFifo(self, device, timeout, logfile=None):
- for i in range(10):
+ for i in range(100):
if device.FileExists(self._GetFifo()):
- logging.info('Fifo created.')
+ logging.info('Fifo created. Slept for %f secs' % (i * 0.5))
break
- time.sleep(i)
+ time.sleep(0.5)
else:
raise device_errors.DeviceUnreachableError(
'Unable to find fifo on device %s ' % self._GetFifo())
@@ -67,14 +67,14 @@ class TestPackageApk(TestPackage):
args += ['shell', 'cat', self._GetFifo()]
return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile)
- def _StartActivity(self, device):
+ def _StartActivity(self, device, force_stop=True):
device.StartActivity(
intent.Intent(package=self._package_info.package,
activity=self._package_info.activity,
action='android.intent.action.MAIN'),
# No wait since the runner waits for FIFO creation anyway.
blocking=False,
- force_stop=True)
+ force_stop=force_stop)
#override
def ClearApplicationState(self, device):
@@ -119,7 +119,10 @@ class TestPackageApk(TestPackage):
try:
self.tool.SetupEnvironment()
self._ClearFifo(device)
- self._StartActivity(device)
+ # Doesn't need to stop an Activity because ClearApplicationState() is
+ # always called before this call and so it is already stopped at this
+ # point.
+ self._StartActivity(device, force_stop=False)
finally:
self.tool.CleanUpEnvironment()
logfile = android_commands.NewLineNormalizer(sys.stdout)
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698