Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: net/test/embedded_test_server/embedded_test_server.h

Issue 83633004: Do not spawn a thread in browser/interactive ui tests before spawning sandbox host process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 21 matching lines...) Expand all
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 private: 41 private:
42 friend class EmbeddedTestServer;
43 void DetachFromThread();
satorux1 2013/11/26 01:22:58 a function comment is missing.
oshima 2013/11/26 02:18:43 Done.
42 44
43 base::ThreadChecker thread_checker_; 45 base::ThreadChecker thread_checker_;
44 }; 46 };
45 47
46 // Class providing an HTTP server for testing purpose. This is a basic server 48 // Class providing an HTTP server for testing purpose. This is a basic server
47 // providing only an essential subset of HTTP/1.1 protocol. Especially, 49 // providing only an essential subset of HTTP/1.1 protocol. Especially,
48 // it assumes that the request syntax is correct. It *does not* support 50 // it assumes that the request syntax is correct. It *does not* support
49 // a Chunked Transfer Encoding. 51 // a Chunked Transfer Encoding.
50 // 52 //
51 // The common use case is below: 53 // The common use case is below:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // For instance, a request to "/foo.html" is served by "foo.html" under 117 // For instance, a request to "/foo.html" is served by "foo.html" under
116 // |directory|. Files under sub directories are also handled in the same way 118 // |directory|. Files under sub directories are also handled in the same way
117 // (i.e. "/foo/bar.html" is served by "foo/bar.html" under |directory|). 119 // (i.e. "/foo/bar.html" is served by "foo/bar.html" under |directory|).
118 void ServeFilesFromDirectory(const base::FilePath& directory); 120 void ServeFilesFromDirectory(const base::FilePath& directory);
119 121
120 // The most general purpose method. Any request processing can be added using 122 // The most general purpose method. Any request processing can be added using
121 // this method. Takes ownership of the object. The |callback| is called 123 // this method. Takes ownership of the object. The |callback| is called
122 // on UI thread. 124 // on UI thread.
123 void RegisterRequestHandler(const HandleRequestCallback& callback); 125 void RegisterRequestHandler(const HandleRequestCallback& callback);
124 126
127 // Starts/Stops IO thread that handles http requests.
128 void StartThread();
129 void StopThread();
130
125 private: 131 private:
126 // Initializes and starts the server. If initialization succeeds, Starts() 132 // Initializes and starts the server. If initialization succeeds, Starts()
127 // will return true. 133 // will return true.
128 void InitializeOnIOThread(); 134 void InitializeOnIOThread();
129 135
130 // Shuts down the server. 136 // Shuts down the server.
131 void ShutdownOnIOThread(); 137 void ShutdownOnIOThread();
132 138
133 // Handles a request when it is parsed. It passes the request to registed 139 // Handles a request when it is parsed. It passes the request to registed
134 // request handlers and sends a http response. 140 // request handlers and sends a http response.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 173
168 base::ThreadChecker thread_checker_; 174 base::ThreadChecker thread_checker_;
169 175
170 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); 176 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer);
171 }; 177 };
172 178
173 } // namespace test_servers 179 } // namespace test_servers
174 } // namespace net 180 } // namespace net
175 181
176 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ 182 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698