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

Side by Side Diff: Tools/Scripts/run-blink-websocketserver

Issue 135583003: checkpoint Blink-side work to use Apache on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: new rollup patch Created 6 years, 10 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (C) 2012 Google Inc. All rights reserved. 2 # Copyright (C) 2012 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 """A utility script for starting and stopping the web socket server with the 30 """A utility script for starting and stopping the web socket server with the
31 same configuration as used in the layout tests.""" 31 same configuration as used in the layout tests."""
32 32
33 import logging 33 import logging
34 import optparse 34 import optparse
35 import tempfile 35 import time
36
37 import webkitpy.common.version_check
36 38
37 from webkitpy.common.host import Host 39 from webkitpy.common.host import Host
38 from webkitpy.layout_tests.servers import websocket_server 40 from webkitpy.layout_tests.servers import websocket_server
39 41
40 42
41 def main(): 43 def main():
42 option_parser = optparse.OptionParser() 44 option_parser = optparse.OptionParser()
43 option_parser.add_option('--server', type='choice',
44 choices=['start', 'stop'], default='start',
45 help='Server action (start|stop).')
46 option_parser.add_option('-p', '--port', dest='port',
47 default=None, help='Port to listen on.')
48 option_parser.add_option('-r', '--root',
49 help='Absolute path to DocumentRoot '
50 '(overrides layout test roots).')
51 option_parser.add_option('-t', '--tls', dest='use_tls',
52 action='store_true',
53 default=False, help='use TLS (wss://).')
54 option_parser.add_option('-k', '--private_key', dest='private_key',
55 default='', help='TLS private key file.')
56 option_parser.add_option('-c', '--certificate', dest='certificate',
57 default='', help='TLS certificate file.')
58 option_parser.add_option('--ca-certificate', dest='ca_certificate',
59 default='', help='TLS CA certificate file for '
60 'client authentication.')
61 option_parser.add_option('--chromium', action='store_true',
62 dest='chromium',
63 default=False,
64 help='Use the Chromium port.')
65 option_parser.add_option('--register_cygwin', action="store_true",
66 dest="register_cygwin",
67 help='Register Cygwin paths (on Win try bots).')
68 option_parser.add_option('--pidfile', help='path to pid file.')
69 option_parser.add_option('--output-dir', dest='output_dir', 45 option_parser.add_option('--output-dir', dest='output_dir',
70 default=None, help='output directory.') 46 default=None, help='output directory.')
71 option_parser.add_option('-v', '--verbose', action='store_true', 47 option_parser.add_option('-v', '--verbose', action='store_true')
72 default=False,
73 help='Include debug-level logging.')
74 options, args = option_parser.parse_args() 48 options, args = option_parser.parse_args()
75 49
76 if not options.port: 50 host = Host()
77 if options.use_tls: 51 port_obj = host.port_factory.get()
78 # FIXME: We shouldn't grab at this private variable.
79 options.port = websocket_server._DEFAULT_WSS_PORT
80 else:
81 # FIXME: We shouldn't grab at this private variable.
82 options.port = websocket_server._DEFAULT_WS_PORT
83
84 if not options.output_dir: 52 if not options.output_dir:
85 options.output_dir = tempfile.gettempdir() 53 options.output_dir = port_obj.default_results_directory()
86
87 kwds = {'port': options.port, 'use_tls': options.use_tls}
88 if options.root:
89 kwds['root'] = options.root
90 if options.private_key:
91 kwds['private_key'] = options.private_key
92 if options.certificate:
93 kwds['certificate'] = options.certificate
94 if options.ca_certificate:
95 kwds['ca_certificate'] = options.ca_certificate
96 if options.pidfile:
97 kwds['pidfile'] = options.pidfile
98
99 host = Host()
100 # FIXME: Make this work with other ports as well.
101 port_obj = host.port_factory.get(port_name='chromium', options=options)
102 pywebsocket = websocket_server.PyWebSocket(port_obj, options.output_dir, **k wds)
103 54
104 log_level = logging.WARN 55 log_level = logging.WARN
105 if options.verbose: 56 if options.verbose:
106 log_level = logging.DEBUG 57 log_level = logging.DEBUG
107 logging.basicConfig(level=log_level) 58 logging.basicConfig(level=log_level)
108 59
109 if 'start' == options.server: 60 pywebsocket = websocket_server.PyWebSocket(port_obj, options.output_dir, num ber_of_servers=4)
110 pywebsocket.start() 61 pywebsocket.start()
111 else: 62 try:
112 pywebsocket.stop() 63 while True:
64 time.sleep(1)
65 except KeyboardInterrupt as e:
66 pass
67 pywebsocket.stop()
113 68
114 if '__main__' == __name__: 69 if '__main__' == __name__:
115 main() 70 main()
OLDNEW
« no previous file with comments | « Tools/Scripts/run-blink-httpd ('k') | Tools/Scripts/webkitpy/layout_tests/controllers/manager.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698