| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A class to help start/stop the lighttpd server used by layout tests.""" | 6 """A class to help start/stop the lighttpd server used by layout tests.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import optparse | 10 import optparse |
| 11 import os | 11 import os |
| 12 import shutil | 12 import shutil |
| 13 import subprocess | 13 import subprocess |
| 14 import sys | 14 import sys |
| 15 import tempfile | 15 import tempfile |
| 16 import time | 16 import time |
| 17 import urllib | 17 import urllib |
| 18 | 18 |
| 19 import path_utils | 19 import path_utils |
| 20 |
| 21 # So we can import httpd_utils below to make ui_tests happy. |
| 22 sys.path.append(path_utils.PathFromBase('tools', 'python')) |
| 20 import google.httpd_utils | 23 import google.httpd_utils |
| 21 | 24 |
| 22 def RemoveLogFiles(folder, starts_with): | 25 def RemoveLogFiles(folder, starts_with): |
| 23 files = os.listdir(folder) | 26 files = os.listdir(folder) |
| 24 for file in files: | 27 for file in files: |
| 25 if file.startswith(starts_with) : | 28 if file.startswith(starts_with) : |
| 26 full_path = os.path.join(folder, file) | 29 full_path = os.path.join(folder, file) |
| 27 os.remove(full_path) | 30 os.remove(full_path) |
| 28 | 31 |
| 29 class Lighttpd: | 32 class Lighttpd: |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 raise 'Specifying port requires also a root.' | 273 raise 'Specifying port requires also a root.' |
| 271 httpd = Lighttpd(tempfile.gettempdir(), | 274 httpd = Lighttpd(tempfile.gettempdir(), |
| 272 port=options.port, | 275 port=options.port, |
| 273 root=options.root, | 276 root=options.root, |
| 274 register_cygwin=options.register_cygwin, | 277 register_cygwin=options.register_cygwin, |
| 275 run_background=options.run_background) | 278 run_background=options.run_background) |
| 276 if 'start' == options.server: | 279 if 'start' == options.server: |
| 277 httpd.Start() | 280 httpd.Start() |
| 278 else: | 281 else: |
| 279 httpd.Stop(force=True) | 282 httpd.Stop(force=True) |
| OLD | NEW |