| 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_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| 6 #define NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 6 #define NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 struct HttpRequest; | 31 struct HttpRequest; |
| 32 | 32 |
| 33 // This class is required to be able to have composition instead of inheritance, | 33 // This class is required to be able to have composition instead of inheritance, |
| 34 class HttpListenSocket : public TCPListenSocket { | 34 class HttpListenSocket : public TCPListenSocket { |
| 35 public: | 35 public: |
| 36 HttpListenSocket(const SocketDescriptor socket_descriptor, | 36 HttpListenSocket(const SocketDescriptor socket_descriptor, |
| 37 StreamListenSocket::Delegate* delegate); | 37 StreamListenSocket::Delegate* delegate); |
| 38 virtual ~HttpListenSocket(); | 38 virtual ~HttpListenSocket(); |
| 39 virtual void Listen(); | 39 virtual void Listen(); |
| 40 | 40 |
| 41 // Listen on the current IO thread. If the IO thread has changed since this |
| 42 // object is constructed, call |ListenOnIOThread| to make sure it listens on |
| 43 // the right thread. Otherwise must call |Listen| instead. |
| 44 void ListenOnIOThread(); |
| 45 |
| 41 private: | 46 private: |
| 42 friend class EmbeddedTestServer; | 47 friend class EmbeddedTestServer; |
| 43 | 48 |
| 44 // Detaches the current from |thread_checker_|. | 49 // Detaches the current from |thread_checker_|. |
| 45 void DetachFromThread(); | 50 void DetachFromThread(); |
| 46 | 51 |
| 47 base::ThreadChecker thread_checker_; | 52 base::ThreadChecker thread_checker_; |
| 48 }; | 53 }; |
| 49 | 54 |
| 50 // Class providing an HTTP server for testing purpose. This is a basic server | 55 // Class providing an HTTP server for testing purpose. This is a basic server |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // invalidate its weak pointers before any other members are destroyed. | 197 // invalidate its weak pointers before any other members are destroyed. |
| 193 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; | 198 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; |
| 194 | 199 |
| 195 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); | 200 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); |
| 196 }; | 201 }; |
| 197 | 202 |
| 198 } // namespace test_servers | 203 } // namespace test_servers |
| 199 } // namespace net | 204 } // namespace net |
| 200 | 205 |
| 201 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 206 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| OLD | NEW |