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

Side by Side Diff: webkit/tools/layout_tests/layout_package/http_server_base.py

Issue 545145: Move the layout test scripts into a 'webkitpy' subdirectory in preparation... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: try to de-confuse svn and the try bots Created 10 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Base class with common routines between the Apache and Lighttpd servers."""
6
7 import logging
8 import time
9 import urllib
10
11
12 class HttpServerBase(object):
13
14 def WaitForAction(self, action):
15 """Repeat the action for 20 seconds or until it succeeds. Returns
16 whether it succeeded."""
17 start_time = time.time()
18 while time.time() - start_time < 20:
19 if action():
20 return True
21 time.sleep(1)
22
23 return False
24
25 def IsServerRunningOnAllPorts(self):
26 """Returns whether the server is running on all the desired ports."""
27 for mapping in self.mappings:
28 if 'sslcert' in mapping:
29 http_suffix = 's'
30 else:
31 http_suffix = ''
32
33 url = 'http%s://127.0.0.1:%d/' % (http_suffix, mapping['port'])
34
35 try:
36 response = urllib.urlopen(url)
37 logging.debug("Server running at %s" % url)
38 except IOError:
39 logging.debug("Server NOT running at %s" % url)
40 return False
41
42 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698