Chromium Code Reviews| 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 # 1. Redistributions of source code must retain the above copyright | 7 # 1. 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 # 2. Redistributions in binary form must reproduce the above copyright | 9 # 2. Redistributions in binary form must reproduce the above copyright |
| 10 # notice, this list of conditions and the following disclaimer in the | 10 # notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 def __init__(self): | 35 def __init__(self): |
| 36 options = [ | 36 options = [ |
| 37 make_option("--httpd-port", action="store", type="int", default=8127 , help="Port to use for the HTTP server"), | 37 make_option("--httpd-port", action="store", type="int", default=8127 , help="Port to use for the HTTP server"), |
| 38 make_option("--no-show-results", action="store_false", default=True, dest="show_results", | 38 make_option("--no-show-results", action="store_false", default=True, dest="show_results", |
| 39 help="Don't launch a browser with the rebaseline server" ), | 39 help="Don't launch a browser with the rebaseline server" ), |
| 40 ] | 40 ] |
| 41 super(AbstractLocalServerCommand, self).__init__(options=options) | 41 super(AbstractLocalServerCommand, self).__init__(options=options) |
| 42 | 42 |
| 43 def _prepare_config(self, options, args, tool): | 43 def _prepare_config(self, options, args, tool): |
| 44 return None | 44 raise NotImplementedError('Subclasses should implement this method.') |
|
qyearsley
2016/06/02 16:41:32
Currently, all subclasses implement this, so the b
| |
| 45 | 45 |
| 46 def execute(self, options, args, tool): | 46 def execute(self, options, args, tool): |
| 47 config = self._prepare_config(options, args, tool) | 47 config = self._prepare_config(options, args, tool) |
| 48 | 48 |
| 49 server_url = "http://localhost:%d%s" % (options.httpd_port, self.launch_ path) | 49 server_url = "http://localhost:%d%s" % (options.httpd_port, self.launch_ path) |
| 50 print "Starting server at %s" % server_url | 50 print "Starting server at %s" % server_url |
| 51 print "Use the 'Exit' link in the UI, %squitquitquit or Ctrl-C to stop" % server_url | 51 print "Use the 'Exit' link in the UI, %squitquitquit or Ctrl-C to stop" % server_url |
| 52 | 52 |
| 53 if options.show_results: | 53 if options.show_results: |
| 54 # FIXME: This seems racy. | 54 # FIXME: This seems racy. |
| 55 threading.Timer(0.1, lambda: self._tool.user.open_url(server_url)).s tart() | 55 threading.Timer(0.1, lambda: self._tool.user.open_url(server_url)).s tart() |
| 56 | 56 |
| 57 httpd = self.server(httpd_port=options.httpd_port, config=config) # pyl int: disable=E1102 | 57 httpd = self.server(httpd_port=options.httpd_port, config=config) # pyl int: disable=E1102 |
| 58 httpd.serve_forever() | 58 httpd.serve_forever() |
| OLD | NEW |