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

Side by Side Diff: net/test/local_test_server.h

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, 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
« no previous file with comments | « net/test/local_sync_test_server.cc ('k') | net/test/local_test_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_TEST_LOCAL_TEST_SERVER_H_ 5 #ifndef NET_TEST_LOCAL_TEST_SERVER_H_
6 #define NET_TEST_LOCAL_TEST_SERVER_H_ 6 #define NET_TEST_LOCAL_TEST_SERVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 25 matching lines...) Expand all
36 const FilePath& document_root); 36 const FilePath& document_root);
37 37
38 virtual ~LocalTestServer(); 38 virtual ~LocalTestServer();
39 39
40 bool Start() WARN_UNUSED_RESULT; 40 bool Start() WARN_UNUSED_RESULT;
41 41
42 // Stop the server started by Start(). 42 // Stop the server started by Start().
43 bool Stop(); 43 bool Stop();
44 44
45 // Modify PYTHONPATH to contain libraries we need. 45 // Modify PYTHONPATH to contain libraries we need.
46 static bool SetPythonPath() WARN_UNUSED_RESULT; 46 virtual bool SetPythonPath() const WARN_UNUSED_RESULT;
47
48 // This is a static version so that RunSyncTest in run_testserver.py can use
49 // it.
50 // TODO(mattm): We should refactor that so this isn't necessary.
51 static bool SetPythonPathStatic() WARN_UNUSED_RESULT;
47 52
48 // Returns true if successfully stored the FilePath for the directory of the 53 // Returns true if successfully stored the FilePath for the directory of the
49 // testserver python script in |*directory|. 54 // testserver python script in |*directory|.
50 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; 55 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT;
51 56
57 // Returns true if successfully stored the FilePath for the testserver python
58 // script in |*testserver_path|.
59 virtual bool GetTestServerPath(FilePath* testserver_path) const
60 WARN_UNUSED_RESULT;
61
52 // Adds the command line arguments for the Python test server to 62 // Adds the command line arguments for the Python test server to
53 // |command_line|. Returns true on success. 63 // |command_line|. Returns true on success.
54 virtual bool AddCommandLineArguments(CommandLine* command_line) const; 64 virtual bool AddCommandLineArguments(CommandLine* command_line) const
65 WARN_UNUSED_RESULT;
55 66
56 private: 67 private:
57 bool Init(const FilePath& document_root); 68 bool Init(const FilePath& document_root);
58 69
59 // Launches the Python test server. Returns true on success. 70 // Launches the Python test server. Returns true on success.
60 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; 71 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT;
61 72
62 // Waits for the server to start. Returns true on success. 73 // Waits for the server to start. Returns true on success.
63 bool WaitToStart() WARN_UNUSED_RESULT; 74 bool WaitToStart() WARN_UNUSED_RESULT;
64 75
76 // Adds the Python command line arguments and test server path to
77 // |command_line|.
78 void AddPythonArguments(const FilePath& testserver_path,
79 CommandLine* command_line) const;
80
65 // Handle of the Python process running the test server. 81 // Handle of the Python process running the test server.
66 base::ProcessHandle process_handle_; 82 base::ProcessHandle process_handle_;
67 83
68 #if defined(OS_WIN) 84 #if defined(OS_WIN)
69 // JobObject used to clean up orphaned child processes. 85 // JobObject used to clean up orphaned child processes.
70 base::win::ScopedHandle job_handle_; 86 base::win::ScopedHandle job_handle_;
71 87
72 // The pipe file handle we read from. 88 // The pipe file handle we read from.
73 base::win::ScopedHandle child_read_fd_; 89 base::win::ScopedHandle child_read_fd_;
74 90
75 // The pipe file handle the child and we write to. 91 // The pipe file handle the child and we write to.
76 base::win::ScopedHandle child_write_fd_; 92 base::win::ScopedHandle child_write_fd_;
77 #endif 93 #endif
78 94
79 #if defined(OS_POSIX) 95 #if defined(OS_POSIX)
80 // The file descriptor the child writes to when it starts. 96 // The file descriptor the child writes to when it starts.
81 int child_fd_; 97 int child_fd_;
82 file_util::ScopedFD child_fd_closer_; 98 file_util::ScopedFD child_fd_closer_;
83 #endif 99 #endif
84 100
85 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); 101 DISALLOW_COPY_AND_ASSIGN(LocalTestServer);
86 }; 102 };
87 103
88 } // namespace net 104 } // namespace net
89 105
90 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ 106 #endif // NET_TEST_LOCAL_TEST_SERVER_H_
OLDNEW
« no previous file with comments | « net/test/local_sync_test_server.cc ('k') | net/test/local_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698