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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 52 // Adds the command line arguments for the Python test server to |
53 // |command_line|. Returns true on success. | 53 // |command_line|. Returns true on success. |
54 virtual bool AddCommandLineArguments(CommandLine* command_line) const; | 54 virtual bool AddCommandLineArguments(CommandLine* command_line) const; |
55 | 55 |
| 56 // Returns the actual path of document root for test cases. This function |
| 57 // should be called by test cases to retrieve the actual document root path. |
| 58 FilePath GetDocumentRoot() const { return document_root(); }; |
| 59 |
56 private: | 60 private: |
57 bool Init(const FilePath& document_root); | 61 bool Init(const FilePath& document_root); |
58 | 62 |
59 // Launches the Python test server. Returns true on success. | 63 // Launches the Python test server. Returns true on success. |
60 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; | 64 bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; |
61 | 65 |
62 // Waits for the server to start. Returns true on success. | 66 // Waits for the server to start. Returns true on success. |
63 bool WaitToStart() WARN_UNUSED_RESULT; | 67 bool WaitToStart() WARN_UNUSED_RESULT; |
64 | 68 |
65 // Handle of the Python process running the test server. | 69 // Handle of the Python process running the test server. |
(...skipping 15 matching lines...) Expand all Loading... |
81 int child_fd_; | 85 int child_fd_; |
82 file_util::ScopedFD child_fd_closer_; | 86 file_util::ScopedFD child_fd_closer_; |
83 #endif | 87 #endif |
84 | 88 |
85 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); | 89 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); |
86 }; | 90 }; |
87 | 91 |
88 } // namespace net | 92 } // namespace net |
89 | 93 |
90 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ | 94 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ |
OLD | NEW |