| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 static bool SetPythonPath() WARN_UNUSED_RESULT; |
| 47 | 47 |
| 48 // Returns true if successfully stored the FilePath for the directory of the | 48 // Returns true if successfully stored the FilePath for the directory of the |
| 49 // testserver python script in |*directory|. | 49 // testserver python script in |*directory|. |
| 50 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; | 50 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; |
| 51 | 51 |
| 52 // Adds the command line arguments for the Python test server to |
| 53 // |command_line|. Returns true on success. |
| 54 virtual bool AddCommandLineArguments(CommandLine* command_line) const; |
| 55 |
| 52 private: | 56 private: |
| 53 bool Init(const FilePath& document_root); | 57 bool Init(const FilePath& document_root); |
| 54 | 58 |
| 55 // Launches the Python test server. Returns true on success. | 59 // Launches the Python test server. Returns true on success. |
| 56 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 60 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
| 57 | 61 |
| 58 // Waits for the server to start. Returns true on success. | 62 // Waits for the server to start. Returns true on success. |
| 59 bool WaitToStart() WARN_UNUSED_RESULT; | 63 bool WaitToStart() WARN_UNUSED_RESULT; |
| 60 | 64 |
| 61 // Add the command line arguments for the Python test server to | |
| 62 // |command_line|. Return true on success. | |
| 63 bool AddCommandLineArguments(CommandLine* command_line) const; | |
| 64 | |
| 65 // Handle of the Python process running the test server. | 65 // Handle of the Python process running the test server. |
| 66 base::ProcessHandle process_handle_; | 66 base::ProcessHandle process_handle_; |
| 67 | 67 |
| 68 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 69 // JobObject used to clean up orphaned child processes. | 69 // JobObject used to clean up orphaned child processes. |
| 70 base::win::ScopedHandle job_handle_; | 70 base::win::ScopedHandle job_handle_; |
| 71 | 71 |
| 72 // The pipe file handle we read from. | 72 // The pipe file handle we read from. |
| 73 base::win::ScopedHandle child_read_fd_; | 73 base::win::ScopedHandle child_read_fd_; |
| 74 | 74 |
| 75 // The pipe file handle the child and we write to. | 75 // The pipe file handle the child and we write to. |
| 76 base::win::ScopedHandle child_write_fd_; | 76 base::win::ScopedHandle child_write_fd_; |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 #if defined(OS_POSIX) | 79 #if defined(OS_POSIX) |
| 80 // The file descriptor the child writes to when it starts. | 80 // The file descriptor the child writes to when it starts. |
| 81 int child_fd_; | 81 int child_fd_; |
| 82 file_util::ScopedFD child_fd_closer_; | 82 file_util::ScopedFD child_fd_closer_; |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); | 85 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace net | 88 } // namespace net |
| 89 | 89 |
| 90 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ | 90 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ |
| OLD | NEW |