Chromium Code Reviews| 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..7a16f22c2a573980b17ad0d5131f6844383adc00 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(110): |
|
jbudorick
2015/01/16 14:21:41
110...?
Jaekyun Seok (inactive)
2015/01/18 23:01:18
I just wanted to keep the total possible sleep tim
jbudorick
2015/01/20 14:11:23
Just make it 100.
Jaekyun Seok (inactive)
2015/01/20 22:00:23
I will do that.
|
| 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,18 +67,20 @@ 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): |
| - device.ClearApplicationState(self._package_info.package) |
| + # The package always exists at this point. |
| + device.ClearApplicationState(self._package_info.package, |
| + package_check_needed=False) |
| # Content shell creates a profile on the sdscard which accumulates cache |
| # files over time. |
| if self.suite_name == 'content_browsertests': |
| @@ -119,7 +121,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) |