summaryrefslogtreecommitdiffstats
path: root/chrome/test/pyautolib
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 17:32:52 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-14 17:32:52 +0000
commitddbe8669f07bedd9e8a49c44d0f56297c0aff7a8 (patch)
treeef1f0f63f04b64dc9ed13247373e60a77f5c0631 /chrome/test/pyautolib
parent044dc143c644e0ced89202823e3915a6b2c2a978 (diff)
downloadchromium_src-ddbe8669f07bedd9e8a49c44d0f56297c0aff7a8.zip
chromium_src-ddbe8669f07bedd9e8a49c44d0f56297c0aff7a8.tar.gz
chromium_src-ddbe8669f07bedd9e8a49c44d0f56297c0aff7a8.tar.bz2
Fix pyauto flakiness by waiting for notification that the renderer process'
termination has been noticed by the browser before reloading the associated tab. BUG=64708 TEST=none Review URL: http://codereview.chromium.org/5755003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r--chrome/test/pyautolib/pyauto.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 054e51e..d762bc0 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -255,7 +255,10 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
@staticmethod
def Kill(pid):
- """Terminate the given pid."""
+ """Terminate the given pid.
+
+ If the pid refers to a renderer, use KillRendererProcess instead.
+ """
if PyUITest.IsWin():
subprocess.call(['taskkill.exe', '/T', '/F', '/PID', str(pid)])
else:
@@ -1966,6 +1969,24 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
if self.GetNTPThumbnailIndex(thumbnail) == -1:
raise NTPThumbnailNotShownError()
+ def KillRendererProcess(self, pid):
+ """Kills the given renderer process.
+
+ This will return only after the browser has received notice of the renderer
+ close.
+
+ Args:
+ pid: the process id of the renderer to kill
+
+ Raises:
+ pyauto_errors.JSONInterfaceError if the automation call returns an error.
+ """
+ cmd_dict = {
+ 'command': 'KillRendererProcess',
+ 'pid': pid
+ }
+ return self._GetResultFromJSONRequest(cmd_dict)
+
class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite):
"""Base TestSuite for PyAuto UI tests."""