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

Unified Diff: net/tools/testserver/testserver.py

Issue 10073033: Run safebrowsing_service_test through the net testserver code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« net/test/remote_test_server.cc ('K') | « net/test/remote_test_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/testserver.py
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 64619975787680a5c9a63db197cbfce70c653c8b..5d35c7d773d3da25f44d83c60ec790f18ecec874 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -64,6 +64,7 @@ SERVER_FTP = 1
SERVER_SYNC = 2
SERVER_TCP_ECHO = 3
SERVER_UDP_ECHO = 4
+SERVER_SAFEBROWSING = 5
# Using debug() seems to cause hangs on XP: see http://crbug.com/64515 .
debug_output = sys.stderr
@@ -2078,8 +2079,7 @@ def main(options, args):
server = UDPEchoServer((host, port), UDPEchoHandler)
print 'Echo UDP server started on port %d...' % server.server_port
server_data['port'] = server.server_port
- # means FTP Server
- else:
+ elif options.server_type == SERVER_FTP:
my_data_dir = MakeDataDir()
# Instantiate a dummy authorizer for managing 'virtual' users
@@ -2103,6 +2103,19 @@ def main(options, args):
server = pyftpdlib.ftpserver.FTPServer((host, port), ftp_handler)
server_data['port'] = server.socket.getsockname()[1]
print 'FTP server started on port %d...' % server_data['port']
+ elif options.server_type == SERVER_SAFEBROWSING:
+ sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ '..', '..', '..', 'third_party',
+ 'safe_browsing', 'testing'))
+ import safebrowsing_test_server
+ server = safebrowsing_test_server.SetupServer(
+ options.data_dir, host, port, opt_enforce_caching=False,
+ opt_validate_database=True)
+ print 'Safebrowsing HTTP server started on port %d...' % server.server_port
+ server_data['port'] = server.server_port
+ else:
+ print 'unknown server type', options.server_type
+ return 1
# Notify the parent that we've started. (BaseServer subclasses
# bind their sockets on construction.)
@@ -2152,6 +2165,10 @@ if __name__ == '__main__':
const=SERVER_UDP_ECHO, default=SERVER_HTTP,
dest='server_type',
help='start up a udp echo server.')
+ option_parser.add_option('', '--safebrowsing', action='store_const',
+ const=SERVER_SAFEBROWSING, default=SERVER_HTTP,
+ dest='server_type',
+ help='start up a safebrowsing test server.')
option_parser.add_option('', '--log-to-console', action='store_const',
const=True, default=False,
dest='log_to_console',
« net/test/remote_test_server.cc ('K') | « net/test/remote_test_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698