| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 """A class to help start/stop the PyWebSocket server used by layout tests.""" | 29 """A class to help start/stop the PyWebSocket server used by layout tests.""" |
| 30 | 30 |
| 31 import logging | 31 import logging |
| 32 import os | 32 import os |
| 33 import sys | 33 import sys |
| 34 import time | 34 import time |
| 35 | 35 |
| 36 from webkitpy.layout_tests.servers import http_server | 36 from webkitpy.layout_tests.servers import lighttpd |
| 37 from webkitpy.layout_tests.servers import http_server_base | 37 from webkitpy.layout_tests.servers import server_base |
| 38 | 38 |
| 39 _log = logging.getLogger(__name__) | 39 _log = logging.getLogger(__name__) |
| 40 | 40 |
| 41 | 41 |
| 42 _WS_LOG_PREFIX = 'pywebsocket.ws.log-' | 42 _WS_LOG_PREFIX = 'pywebsocket.ws.log-' |
| 43 _WSS_LOG_PREFIX = 'pywebsocket.wss.log-' | 43 _WSS_LOG_PREFIX = 'pywebsocket.wss.log-' |
| 44 | 44 |
| 45 | 45 |
| 46 _DEFAULT_WS_PORT = 8880 | 46 _DEFAULT_WS_PORT = 8880 |
| 47 _DEFAULT_WSS_PORT = 9323 | 47 _DEFAULT_WSS_PORT = 9323 |
| 48 | 48 |
| 49 | 49 |
| 50 class PyWebSocket(http_server.Lighttpd): | 50 class PyWebSocket(lighttpd.Lighttpd): |
| 51 def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT, | 51 def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT, |
| 52 root=None, use_tls=False, | 52 root=None, use_tls=False, |
| 53 private_key=None, certificate=None, ca_certificate=None, | 53 private_key=None, certificate=None, ca_certificate=None, |
| 54 pidfile=None): | 54 pidfile=None): |
| 55 """Args: | 55 """Args: |
| 56 output_dir: the absolute path to the layout test result directory | 56 output_dir: the absolute path to the layout test result directory |
| 57 """ | 57 """ |
| 58 http_server.Lighttpd.__init__(self, port_obj, output_dir, | 58 super(PyWebSocket, self).__init__(port_obj, output_dir, |
| 59 port=_DEFAULT_WS_PORT, | 59 port=_DEFAULT_WS_PORT, |
| 60 root=root) | 60 root=root) |
| 61 self._output_dir = output_dir | 61 self._output_dir = output_dir |
| 62 self._pid_file = pidfile | 62 self._pid_file = pidfile |
| 63 self._process = None | 63 self._process = None |
| 64 | 64 |
| 65 self._port = port | 65 self._port = port |
| 66 self._root = root | 66 self._root = root |
| 67 self._use_tls = use_tls | 67 self._use_tls = use_tls |
| 68 | 68 |
| 69 self._name = 'pywebsocket' | 69 self._name = 'pywebsocket' |
| 70 if self._use_tls: | 70 if self._use_tls: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 def _stop_running_server(self): | 167 def _stop_running_server(self): |
| 168 super(PyWebSocket, self)._stop_running_server() | 168 super(PyWebSocket, self)._stop_running_server() |
| 169 | 169 |
| 170 if self._wsin: | 170 if self._wsin: |
| 171 self._wsin.close() | 171 self._wsin.close() |
| 172 self._wsin = None | 172 self._wsin = None |
| 173 if self._wsout: | 173 if self._wsout: |
| 174 self._wsout.close() | 174 self._wsout.close() |
| 175 self._wsout = None | 175 self._wsout = None |
| OLD | NEW |