| Index: chrome/test/pyautolib/pyauto.py
|
| diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
|
| index 1ba07cb79e5e8cca8804c49017d6d7dbe54e0bdc..036a7443eaa384d5454fefb3292e031a114a5e70 100644
|
| --- a/chrome/test/pyautolib/pyauto.py
|
| +++ b/chrome/test/pyautolib/pyauto.py
|
| @@ -171,11 +171,41 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
|
| def tearDown(self):
|
| self.TearDown() # Destroy browser
|
|
|
| - @staticmethod
|
| - def CloseChromeOnChromeOS():
|
| + def CloseChromeOnChromeOS(self):
|
| """Gracefully exit chrome on ChromeOS."""
|
| +
|
| + def _GetListOfChromePids():
|
| + """Retrieves the list of currently-running Chrome process IDs.
|
| +
|
| + Returns:
|
| + A list of strings, where each string represents a currently-running
|
| + 'chrome' process ID.
|
| + """
|
| + proc = subprocess.Popen(['pgrep', 'chrome'], stdout=subprocess.PIPE)
|
| + proc.wait()
|
| + return [x.strip() for x in proc.stdout.readlines()]
|
| +
|
| + orig_pids = _GetListOfChromePids()
|
| subprocess.call(['pkill', 'chrome'])
|
|
|
| + def _AreOrigPidsDead(orig_pids):
|
| + """Determines whether all originally-running 'chrome' processes are dead.
|
| +
|
| + Args:
|
| + orig_pids: A list of strings, where each string represents the PID for
|
| + an originally-running 'chrome' process.
|
| +
|
| + Returns:
|
| + True, if all originally-running 'chrome' processes have been killed, or
|
| + False otherwise.
|
| + """
|
| + for new_pid in _GetListOfChromePids():
|
| + if new_pid in orig_pids:
|
| + return False
|
| + return True
|
| +
|
| + self.WaitUntil(lambda: _AreOrigPidsDead(orig_pids))
|
| +
|
| def EnableChromeTestingOnChromeOS(self):
|
| """Enables the named automation interface on chromeos.
|
|
|
|
|