Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: chrome/test/functional/test_clean_exit.py

Issue 10834068: On Posix, make all child processes quit when the browser dies, not just the renderers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/perf.py ('k') | content/browser/browser_child_process_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import signal 8 import signal
9 import subprocess 9 import subprocess
10 import tempfile 10 import tempfile
11 import unittest 11 import unittest
12 12
13 import pyauto_functional 13 import pyauto_functional
14 import pyauto 14 import pyauto
15 import test_utils 15 import test_utils
16 16
17 17
18 class SimpleTest(pyauto.PyUITest): 18 class SimpleTest(pyauto.PyUITest):
19 19
20 def ExtraChromeFlags(self): 20 def ExtraChromeFlags(self):
21 """Ensures Chrome is launched with custom flags. 21 """Ensures Chrome is launched with custom flags.
22 22
23 Returns: 23 Returns:
24 A list of extra flags to pass to Chrome when it is launched. 24 A list of extra flags to pass to Chrome when it is launched.
25 """ 25 """
26 fd, self._strace_log = tempfile.mkstemp() 26 fd, self._strace_log = tempfile.mkstemp()
27 os.close(fd) 27 os.close(fd)
28 extra_flags = ['--no-sandbox', '--renderer-clean-exit', 28 extra_flags = ['--no-sandbox', '--child-clean-exit',
29 '--renderer-cmd-prefix=/usr/bin/strace -o %s' % 29 '--renderer-cmd-prefix=/usr/bin/strace -o %s' %
30 self._strace_log] 30 self._strace_log]
31 logging.debug('Strace file is: %s' % self._strace_log) 31 logging.debug('Strace file is: %s' % self._strace_log)
32 return pyauto.PyUITest.ExtraChromeFlags(self) + extra_flags 32 return pyauto.PyUITest.ExtraChromeFlags(self) + extra_flags
33 33
34 34
35 def testCleanExit(self): 35 def testCleanExit(self):
36 """Ensures the renderer process cleanly exits.""" 36 """Ensures the renderer process cleanly exits."""
37 url = self.GetHttpURLForDataPath('title2.html') 37 url = self.GetHttpURLForDataPath('title2.html')
38 self.NavigateToURL(url) 38 self.NavigateToURL(url)
39 os.kill(self.GetBrowserInfo()['browser_pid'], signal.SIGINT) 39 os.kill(self.GetBrowserInfo()['browser_pid'], signal.SIGINT)
40 self.WaitUntil(lambda: self._IsFileOpen(self._strace_log)) 40 self.WaitUntil(lambda: self._IsFileOpen(self._strace_log))
41 strace_contents = open(self._strace_log).read() 41 strace_contents = open(self._strace_log).read()
42 self.assertTrue('exit_group' in strace_contents) 42 self.assertTrue('exit_group' in strace_contents)
43 os.remove(self._strace_log) 43 os.remove(self._strace_log)
44 44
45 def _IsFileOpen(self, filename): 45 def _IsFileOpen(self, filename):
46 p = subprocess.Popen(['lsof', filename]) 46 p = subprocess.Popen(['lsof', filename])
47 return p.communicate()[0] == '' 47 return p.communicate()[0] == ''
48 48
49 49
50 if __name__ == '__main__': 50 if __name__ == '__main__':
51 pyauto_functional.Main() 51 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/perf.py ('k') | content/browser/browser_child_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698