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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_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: fix warning Created 8 years, 3 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 #!/usr/bin/env python
2 # Copyright (c) 2012 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 """Wraps the upstream safebrowsing_test_server.py to run in Chrome tests."""
7
8 import os
9 import sys
10
11 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
12 '..', '..', '..', 'net',
13 'tools', 'testserver'))
14 import testserver_base
15
16 class ServerRunner(testserver_base.TestServerRunner):
17 def create_server(self, server_data):
18 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),
19 '..', '..', '..', 'third_party',
20 'safe_browsing', 'testing'))
21 import safebrowsing_test_server
22 server = safebrowsing_test_server.SetupServer(
23 self.options.data_file, self.options.host, self.options.port,
24 opt_enforce_caching=False, opt_validate_database=True)
25 print 'Safebrowsing HTTP server started on port %d...' % server.server_port
26 server_data['port'] = server.server_port
27
28 return server
29
30 def add_options(self):
31 testserver_base.TestServerRunner.add_options(self)
32 self.option_parser.add_option('', '--data-file', dest='data_file',
33 help='File containing safebrowsing test '
34 'data and expectations')
35 # TODO(mattm): we define an unnecessary --data-dir option because
36 # BaseTestServer unconditionally sets --data-dir. This should be removed
37 # when BaseTestServer is refactored to not contain all the net/
38 # test_server.py specific stuff.
39 self.option_parser.add_option('', '--data-dir', dest='data_dir',
40 help='unused')
41
42 if __name__ == '__main__':
43 sys.exit(ServerRunner().main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698