OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SPAWNED_TEST_SERVER_LOCAL_TEST_SERVER_H_ | 5 #ifndef NET_TEST_SPAWNED_TEST_SERVER_LOCAL_TEST_SERVER_H_ |
6 #define NET_TEST_SPAWNED_TEST_SERVER_LOCAL_TEST_SERVER_H_ | 6 #define NET_TEST_SPAWNED_TEST_SERVER_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" |
11 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
12 #include "net/test/spawned_test_server/base_test_server.h" | 12 #include "net/test/spawned_test_server/base_test_server.h" |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
16 #endif | 16 #endif |
17 | 17 |
| 18 namespace base { |
18 class CommandLine; | 19 class CommandLine; |
| 20 } |
19 | 21 |
20 namespace net { | 22 namespace net { |
21 | 23 |
22 // The LocalTestServer runs an external Python-based test server in the | 24 // The LocalTestServer runs an external Python-based test server in the |
23 // same machine in which the LocalTestServer runs. | 25 // same machine in which the LocalTestServer runs. |
24 class LocalTestServer : public BaseTestServer { | 26 class LocalTestServer : public BaseTestServer { |
25 public: | 27 public: |
26 // Initialize a TestServer listening on a specific host (IP or hostname). | 28 // Initialize a TestServer listening on a specific host (IP or hostname). |
27 // |document_root| must be a relative path under the root tree. | 29 // |document_root| must be a relative path under the root tree. |
28 LocalTestServer(Type type, | 30 LocalTestServer(Type type, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Modify PYTHONPATH to contain libraries we need. | 68 // Modify PYTHONPATH to contain libraries we need. |
67 virtual bool SetPythonPath() const WARN_UNUSED_RESULT; | 69 virtual bool SetPythonPath() const WARN_UNUSED_RESULT; |
68 | 70 |
69 // Returns true if the base::FilePath for the testserver python script is | 71 // Returns true if the base::FilePath for the testserver python script is |
70 // successfully stored in |*testserver_path|. | 72 // successfully stored in |*testserver_path|. |
71 virtual bool GetTestServerPath(base::FilePath* testserver_path) const | 73 virtual bool GetTestServerPath(base::FilePath* testserver_path) const |
72 WARN_UNUSED_RESULT; | 74 WARN_UNUSED_RESULT; |
73 | 75 |
74 // Adds the command line arguments for the Python test server to | 76 // Adds the command line arguments for the Python test server to |
75 // |command_line|. Returns true on success. | 77 // |command_line|. Returns true on success. |
76 virtual bool AddCommandLineArguments(CommandLine* command_line) const | 78 virtual bool AddCommandLineArguments(base::CommandLine* command_line) const |
77 WARN_UNUSED_RESULT; | 79 WARN_UNUSED_RESULT; |
78 | 80 |
79 // Returns the actual path of document root for test cases. This function | 81 // Returns the actual path of document root for test cases. This function |
80 // should be called by test cases to retrieve the actual document root path. | 82 // should be called by test cases to retrieve the actual document root path. |
81 base::FilePath GetDocumentRoot() const { return document_root(); }; | 83 base::FilePath GetDocumentRoot() const { return document_root(); }; |
82 | 84 |
83 private: | 85 private: |
84 bool Init(const base::FilePath& document_root); | 86 bool Init(const base::FilePath& document_root); |
85 | 87 |
86 // Launches the Python test server. Returns true on success. | 88 // Launches the Python test server. Returns true on success. |
(...skipping 21 matching lines...) Expand all Loading... |
108 int child_fd_; | 110 int child_fd_; |
109 file_util::ScopedFD child_fd_closer_; | 111 file_util::ScopedFD child_fd_closer_; |
110 #endif | 112 #endif |
111 | 113 |
112 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); | 114 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); |
113 }; | 115 }; |
114 | 116 |
115 } // namespace net | 117 } // namespace net |
116 | 118 |
117 #endif // NET_TEST_SPAWNED_TEST_SERVER_LOCAL_TEST_SERVER_H_ | 119 #endif // NET_TEST_SPAWNED_TEST_SERVER_LOCAL_TEST_SERVER_H_ |
OLD | NEW |