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 19 matching lines...) Expand all Loading... |
30 const FilePath& document_root); | 30 const FilePath& document_root); |
31 | 31 |
32 // Initialize a TestServer with a specific set of SSLOptions. | 32 // Initialize a TestServer with a specific set of SSLOptions. |
33 // |document_root| must be a relative path under the root tree. | 33 // |document_root| must be a relative path under the root tree. |
34 LocalTestServer(Type type, | 34 LocalTestServer(Type type, |
35 const SSLOptions& ssl_options, | 35 const SSLOptions& ssl_options, |
36 const FilePath& document_root); | 36 const FilePath& document_root); |
37 | 37 |
38 virtual ~LocalTestServer(); | 38 virtual ~LocalTestServer(); |
39 | 39 |
| 40 // Start the test server and block until it's ready. Returns true on success, |
| 41 // false on failure. |
40 bool Start() WARN_UNUSED_RESULT; | 42 bool Start() WARN_UNUSED_RESULT; |
41 | 43 |
| 44 // Start the test server without blocking. Use this if you need multiple test |
| 45 // servers (such as WebSockets and HTTP, or HTTP and HTTPS). You must call |
| 46 // BlockUntilStarted on all servers your test requires before executing the |
| 47 // test. Returns true on success, false on failure. |
| 48 bool StartInBackground() WARN_UNUSED_RESULT; |
| 49 |
| 50 // Block until ths test server is ready. You must call BlockUntilStarted() on |
| 51 // all servers your test requires before executing the test. Returns true on |
| 52 // success, false on failure. |
| 53 bool BlockUntilStarted() WARN_UNUSED_RESULT; |
| 54 |
42 // Stop the server started by Start(). | 55 // Stop the server started by Start(). |
43 bool Stop(); | 56 bool Stop(); |
44 | 57 |
45 // Modify PYTHONPATH to contain libraries we need. | 58 // Modify PYTHONPATH to contain libraries we need. |
46 virtual bool SetPythonPath() const WARN_UNUSED_RESULT; | 59 virtual bool SetPythonPath() const WARN_UNUSED_RESULT; |
47 | 60 |
48 // This is a static version so that RunSyncTest in run_testserver.cc can use | 61 // This is a static version so that RunSyncTest in run_testserver.cc can use |
49 // it. | 62 // it. |
50 // TODO(mattm): We should refactor so this isn't necessary (crbug.com/159731). | 63 // TODO(mattm): We should refactor so this isn't necessary (crbug.com/159731). |
51 static bool SetPythonPathStatic() WARN_UNUSED_RESULT; | 64 static bool SetPythonPathStatic() WARN_UNUSED_RESULT; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 int child_fd_; | 109 int child_fd_; |
97 file_util::ScopedFD child_fd_closer_; | 110 file_util::ScopedFD child_fd_closer_; |
98 #endif | 111 #endif |
99 | 112 |
100 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); | 113 DISALLOW_COPY_AND_ASSIGN(LocalTestServer); |
101 }; | 114 }; |
102 | 115 |
103 } // namespace net | 116 } // namespace net |
104 | 117 |
105 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ | 118 #endif // NET_TEST_LOCAL_TEST_SERVER_H_ |
OLD | NEW |