Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 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 | |
| 62 // Adds the Python command line arguments and test server path to | |
| 63 // |command_line|. | |
| 64 void AddPythonArguments(const FilePath& testserver_path, | |
|
Ryan Sleevi
2012/08/31 21:48:39
This seems like it should be private. Where is it
mattm
2012/09/01 01:44:54
Done.
| |
| 65 CommandLine* command_line) const; | |
| 66 | |
| 52 // Adds the command line arguments for the Python test server to | 67 // Adds the command line arguments for the Python test server to |
| 53 // |command_line|. Returns true on success. | 68 // |command_line|. Returns true on success. |
| 54 virtual bool AddCommandLineArguments(CommandLine* command_line) const; | 69 virtual bool AddCommandLineArguments(CommandLine* command_line) const |
| 70 WARN_UNUSED_RESULT; | |
| 55 | 71 |
| 56 private: | 72 private: |
| 57 bool Init(const FilePath& document_root); | 73 bool Init(const FilePath& document_root); |
| 58 | 74 |
| 59 // Launches the Python test server. Returns true on success. | 75 // Launches the Python test server. Returns true on success. |
| 60 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 76 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
| 61 | 77 |
| 62 // Waits for the server to start. Returns true on success. | 78 // Waits for the server to start. Returns true on success. |
| 63 bool WaitToStart() WARN_UNUSED_RESULT; | 79 bool WaitToStart() WARN_UNUSED_RESULT; |
| 64 | 80 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 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_ |
| OLD | NEW |