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

Side by Side Diff: client/site_tests/security_RendererSandbox/security_RendererSandbox.py

Issue 2822047: Test for browser sandbox (Issue 4530) (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Fixing a few small stylistic bits Created 10 years, 5 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
« no previous file with comments | « client/site_tests/security_RendererSandbox/control ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 import os, subprocess, time
7 from autotest_lib.client.bin import site_utils, test, utils
8 from autotest_lib.client.common_lib import error, site_ui
9
10
11 class security_RendererSandbox(test.test):
12 version = 1
13 render_pid = -1
14
15 def run_once(self, time_to_wait=20):
16 # open browser to google.com.
17 session = site_ui.ChromeSession('http://www.google.com')
18
19 try:
20 # wait till the page is loaded and poll for the renderer pid
21 # if renderer pid is found, it is stored in self.render_pid
22 site_utils.poll_for_condition(
23 self._get_renderer_pid,
24 error.TestFail('Timed out waiting to obtain pid of renderer'),
25 time_to_wait)
26
27 #check if renderer is sandboxed
28 cwd_contents = os.listdir('/proc/%s/cwd' % self.render_pid)
29 if len(cwd_contents) > 0:
30 raise error.TestFail('Contents present in the CWD directory')
31 finally:
32 session.close()
33
34
35 # queries pgrep for the pid of the renderer. since this function is passed
36 # as an argument to site_utils.poll_for_condition, the return values are set
37 # to true/false depending on whether a pid has been found
38 def _get_renderer_pid(self):
39 pgrep = subprocess.Popen(['pgrep', '-f', '%s' % 'type=renderer'],
40 stdout=subprocess.PIPE)
41 pids = pgrep.communicate()[0].split()
42 if pids:
43 self.render_pid = pids[0]
44 return True
45 else:
46 return False
OLDNEW
« no previous file with comments | « client/site_tests/security_RendererSandbox/control ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698