| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const FilePath& document_root); | 35 const FilePath& document_root); |
| 36 | 36 |
| 37 virtual ~LocalTestServer(); | 37 virtual ~LocalTestServer(); |
| 38 | 38 |
| 39 bool Start() WARN_UNUSED_RESULT; | 39 bool Start() WARN_UNUSED_RESULT; |
| 40 | 40 |
| 41 // Stop the server started by Start(). | 41 // Stop the server started by Start(). |
| 42 bool Stop(); | 42 bool Stop(); |
| 43 | 43 |
| 44 // Modify PYTHONPATH to contain libraries we need. | 44 // Modify PYTHONPATH to contain libraries we need. |
| 45 static bool SetPythonPath() WARN_UNUSED_RESULT; | 45 virtual bool SetPythonPath() const WARN_UNUSED_RESULT; |
| 46 |
| 47 // This is a static version so that RunSyncTest in run_testserver.py can use |
| 48 // it. |
| 49 // TODO(mattm): We should refactor that so this isn't necessary. |
| 50 static bool SetPythonPathStatic() WARN_UNUSED_RESULT; |
| 46 | 51 |
| 47 // Returns true if successfully stored the FilePath for the directory of the | 52 // Returns true if successfully stored the FilePath for the directory of the |
| 48 // testserver python script in |*directory|. | 53 // testserver python script in |*directory|. |
| 49 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; | 54 static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; |
| 50 | 55 |
| 56 // Returns true if successfully stored the FilePath for the testserver python |
| 57 // script in |*testserver_path|. |
| 58 virtual bool GetTestServerPath(FilePath* testserver_path) const |
| 59 WARN_UNUSED_RESULT; |
| 60 |
| 61 // Adds the Python command line arguments and test server path to |
| 62 // |command_line|. |
| 63 void AddPythonArguments(const FilePath& testserver_path, |
| 64 CommandLine* command_line) const; |
| 65 |
| 51 // Adds the command line arguments for the Python test server to | 66 // Adds the command line arguments for the Python test server to |
| 52 // |command_line|. Returns true on success. | 67 // |command_line|. Returns true on success. |
| 53 virtual bool AddCommandLineArguments(CommandLine* command_line) const; | 68 virtual bool AddCommandLineArguments(CommandLine* command_line) const |
| 69 WARN_UNUSED_RESULT; |
| 54 | 70 |
| 55 private: | 71 private: |
| 56 bool Init(const FilePath& document_root); | 72 bool Init(const FilePath& document_root); |
| 57 | 73 |
| 58 // Launches the Python test server. Returns true on success. | 74 // Launches the Python test server. Returns true on success. |
| 59 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 75 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
| 60 | 76 |
| 61 // Waits for the server to start. Returns true on success. | 77 // Waits for the server to start. Returns true on success. |
| 62 bool WaitToStart() WARN_UNUSED_RESULT; | 78 bool WaitToStart() WARN_UNUSED_RESULT; |
| 63 | 79 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 int child_fd_; | 96 int child_fd_; |
| 81 file_util::ScopedFD child_fd_closer_; | 97 file_util::ScopedFD child_fd_closer_; |
| 82 #endif | 98 #endif |
| 83 | 99 |
| 84 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); | 100 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); |
| 85 }; | 101 }; |
| 86 | 102 |
| 87 } // namespace net | 103 } // namespace net |
| 88 | 104 |
| 89 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ | 105 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ |
| OLD | NEW |