| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Tests playback. | |
| 7 | |
| 8 Prerequisites: | |
| 9 1. OpenSSL library - http://www.openssl.org/ | |
| 10 2. Python interface to the OpenSSL library - https://launchpad.net/pyopenssl | |
| 11 | |
| 12 Example usage: | |
| 13 python run.py -t <test_dir> | |
| 14 """ | |
| 15 | |
| 16 from optparse import OptionParser | |
| 17 import sys | |
| 18 | |
| 19 import playback_driver | |
| 20 import proxy_handler | |
| 21 | |
| 22 | |
| 23 def Run(options): | |
| 24 driver = playback_driver.PlaybackRequestHandler(options.test_dir) | |
| 25 httpd = proxy_handler.CreateServer(driver, options.port) | |
| 26 sa = httpd.socket.getsockname() | |
| 27 print "Serving HTTP on", sa[0], "port", sa[1], "..." | |
| 28 httpd.serve_forever() | |
| 29 | |
| 30 | |
| 31 def main(): | |
| 32 parser = OptionParser() | |
| 33 parser.add_option("-t", "--test-dir", dest="test_dir", | |
| 34 help="directory containing recorded test data") | |
| 35 parser.add_option("-p", "--port", dest="port", type="int", default=8000) | |
| 36 options = parser.parse_args()[0] | |
| 37 if not options.test_dir: | |
| 38 raise Exception('please specify test directory') | |
| 39 | |
| 40 Run(options) | |
| 41 | |
| 42 | |
| 43 if __name__ == '__main__': | |
| 44 sys.exit(main()) | |
| OLD | NEW |