Commit c9b58467 authored by Matthew Cary's avatar Matthew Cary Committed by Commit Bot

Orderfile: use reliable package killing.

The device_utils.KillAll command is not reliable for chrome. This
command uses `ps` on the device to enumerate all pids for a package,
and then does a `kill` for each pid. If, for example, a chrome browser
process is killed by the host, and a dependent renderer process dies
before the host can get around to killing it, device_utils.KillAll
will think that the kill failed and raise an exception.

This could be circumvented either by passing quiet=True to KillAll, or
by using the activity manager force-stop command, as is done in the
CL. This latter method seems to be the current preferred way to
gracefully kill all processes of a package.

Bug: 898979
Change-Id: I0451c04b1d9e9ab919dde5e12df247fce3a7651a
Reviewed-on: https://chromium-review.googlesource.com/c/1329152
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607532}
parent 330ebc0b
......@@ -356,6 +356,7 @@ class AndroidProfileTool(object):
_SimulateSwipe(self._device, 200, 700, 200, 1000)
_SimulateSwipe(self._device, 200, 700, 200, 1000)
time.sleep(30)
self._AssertRunning(package_info)
self._KillChrome(package_info)
def Cleanup(self):
......@@ -424,8 +425,13 @@ class AndroidProfileTool(object):
extras={'create_new_tab': True}),
blocking=True, force_stop=True)
def _AssertRunning(self, package_info):
assert self._device.GetApplicationPids(package_info.package), (
'Expected at least one pid associated with {} but found none'.format(
package_info.package))
def _KillChrome(self, package_info):
self._device.KillAll(package_info.package)
self._device.ForceStop(package_info.package)
def _DeleteHostData(self):
"""Clears out profile storage locations on the host."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment