summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authornewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-20 00:28:35 +0000
committernewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-20 00:28:35 +0000
commit2e53058917f32b00cb602bc52354d7308d1729ed (patch)
treeca7a9d155be2f194b139b72637f25025e0d73bfb /net/tools
parent199961a8db5b1d49954eaf10ee7f9f23cce6ec40 (diff)
downloadchromium_src-2e53058917f32b00cb602bc52354d7308d1729ed.zip
chromium_src-2e53058917f32b00cb602bc52354d7308d1729ed.tar.gz
chromium_src-2e53058917f32b00cb602bc52354d7308d1729ed.tar.bz2
Upstream Android-specific net/ changes.
BUG=136750 Review URL: https://chromiumcodereview.appspot.com/11191047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-xnet/tools/testserver/testserver.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 9f7d9b7..9f10bf1 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -1970,7 +1970,7 @@ class SyncPageHandler(BasePageHandler):
return True;
-def MakeDataDir():
+def MakeDataDir(options):
if options.data_dir:
if not os.path.isdir(options.data_dir):
print 'specified data dir not found: ' + options.data_dir + ' exiting...'
@@ -2163,10 +2163,7 @@ class FileMultiplexer:
self.__fd2 = fd2
def __del__(self) :
- if self.__fd1 != sys.stdout and self.__fd1 != sys.stderr:
- self.__fd1.close()
- if self.__fd2 != sys.stdout and self.__fd2 != sys.stderr:
- self.__fd2.close()
+ self.close()
def write(self, text) :
self.__fd1.write(text)
@@ -2176,6 +2173,13 @@ class FileMultiplexer:
self.__fd1.flush()
self.__fd2.flush()
+ def close(self):
+ if self.__fd1 != sys.stdout and self.__fd1 != sys.stderr:
+ self.__fd1.close()
+ if self.__fd2 != sys.stdout and self.__fd2 != sys.stderr:
+ self.__fd2.close()
+
+
def main(options, args):
logfile = open('testserver.log', 'w')
sys.stderr = FileMultiplexer(sys.stderr, logfile)
@@ -2247,7 +2251,7 @@ def main(options, args):
server = HTTPServer((host, port), TestPageHandler)
print 'HTTP server started on %s:%d...' % (host, server.server_port)
- server.data_dir = MakeDataDir()
+ server.data_dir = MakeDataDir(options)
server.file_root_url = options.file_root_url
server_data['port'] = server.server_port
server._device_management_handler = None
@@ -2260,7 +2264,7 @@ def main(options, args):
logger.addHandler(logging.StreamHandler())
# TODO(toyoshim): Remove following os.chdir. Currently this operation
# is required to work correctly. It should be fixed from pywebsocket side.
- os.chdir(MakeDataDir())
+ os.chdir(MakeDataDir(options))
websocket_options = WebSocketOptions(host, port, '.')
if options.cert_and_key_file:
websocket_options.use_tls = True
@@ -2309,7 +2313,7 @@ def main(options, args):
server_data['port'] = server.server_port
# means FTP Server
else:
- my_data_dir = MakeDataDir()
+ my_data_dir = MakeDataDir(options)
# Instantiate a dummy authorizer for managing 'virtual' users
authorizer = pyftpdlib.ftpserver.DummyAuthorizer()