Chromium Code Reviews| Index: chrome/test/webdriver/test/chromedriver_tests.py |
| diff --git a/chrome/test/webdriver/test/chromedriver_tests.py b/chrome/test/webdriver/test/chromedriver_tests.py |
| index f5a5d2892bcb691ef88d20bd390565d7c56a94a5..9b209e0456a7b726c3e2f1b43c9bfbc1f65b9c26 100644 |
| --- a/chrome/test/webdriver/test/chromedriver_tests.py |
| +++ b/chrome/test/webdriver/test/chromedriver_tests.py |
| @@ -14,6 +14,7 @@ from distutils import archive_util |
| import hashlib |
| import os |
| import platform |
| +import signal |
| import subprocess |
| import sys |
| import tempfile |
| @@ -71,6 +72,14 @@ def IsMac(): |
| return sys.platform.startswith('darwin') |
| +def Kill(pid): |
| + """Terminate the given pid.""" |
| + if IsWindows(): |
| + subprocess.call(['taskkill.exe', '/T', '/F', '/PID', str(pid)]) |
| + else: |
| + os.kill(pid, signal.SIGTERM) |
| + |
| + |
| class Request(urllib2.Request): |
| """Extends urllib2.Request to support all HTTP request types.""" |
| @@ -324,6 +333,30 @@ class DesiredCapabilitiesTest(ChromeDriverTest): |
| self.assertNotEqual(-1, driver.page_source.find('ExtTest2')) |
| driver.quit() |
| + |
| +class DetachProcessTest(unittest.TestCase): |
| + |
| + def setUp(self): |
| + self._server = ChromeDriverLauncher(test_paths.CHROMEDRIVER_EXE).Launch() |
| + self._factory = ChromeDriverFactory(self._server) |
| + |
| + def tearDown(self): |
| + self._server.Kill() |
| + |
| + # TODO(kkania): Remove this when Chrome 15 is stable. |
| + def testDetachProcess(self): |
| + # This is a weak test. Its purpose is to just make sure we can start |
| + # Chrome successfully in detached mode. There's not an easy way to know |
| + # if Chrome is shutting down due to the channel error when the client |
| + # disconnects. |
| + driver = self._factory.GetNewDriver({'chrome.detach': True}) |
| + driver.get('about:memory') |
| + pid = int(driver.find_elements_by_xpath('//*[@jscontent="pid"]')[0].text) |
| + self._server.Kill() |
| + os.kill(pid, 0) # Would throw if process no longer exists |
|
Huyen
2011/08/18 23:54:49
Maybe assert process exists and fail to be more ob
kkania
2011/08/19 18:28:32
Done.
|
| + Kill(pid) |
| + |
| + |
| class CookieTest(ChromeDriverTest): |
| """Cookie test for the json webdriver protocol""" |