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

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

Issue 14914010: GTTF: Convert WebContentsImplBrowserTest to use EmbeddedTestServer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months 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
« no previous file with comments | « net/net.gyp ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "net/socket/tcp_listen_socket.h" 18 #include "net/socket/tcp_listen_socket.h"
19 19
20 namespace base {
21 class FilePath;
22 }
23
20 namespace net { 24 namespace net {
21 namespace test_server { 25 namespace test_server {
22 26
23 class HttpConnection; 27 class HttpConnection;
24 class HttpResponse; 28 class HttpResponse;
25 struct HttpRequest; 29 struct HttpRequest;
26 30
27 // This class is required to be able to have composition instead of inheritance, 31 // This class is required to be able to have composition instead of inheritance,
28 class HttpListenSocket : public TCPListenSocket { 32 class HttpListenSocket : public TCPListenSocket {
29 public: 33 public:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const GURL& base_url() const { return base_url_; } 104 const GURL& base_url() const { return base_url_; }
101 105
102 // Returns a URL to the server based on the given relative URL, which 106 // Returns a URL to the server based on the given relative URL, which
103 // should start with '/'. For example: GetURL("/path?query=foo") => 107 // should start with '/'. For example: GetURL("/path?query=foo") =>
104 // http://127.0.0.1:<port>/path?query=foo. 108 // http://127.0.0.1:<port>/path?query=foo.
105 GURL GetURL(const std::string& relative_url) const; 109 GURL GetURL(const std::string& relative_url) const;
106 110
107 // Returns the port number used by the server. 111 // Returns the port number used by the server.
108 int port() const { return port_; } 112 int port() const { return port_; }
109 113
114 // Registers request handler which serves files from |directory|.
115 // 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
117 // (i.e. "/foo/bar.html" is served by "foo/bar.html" under |directory|).
118 void ServeFilesFromDirectory(const base::FilePath& directory);
119
110 // The most general purpose method. Any request processing can be added using 120 // The most general purpose method. Any request processing can be added using
111 // this method. Takes ownership of the object. The |callback| is called 121 // this method. Takes ownership of the object. The |callback| is called
112 // on UI thread. 122 // on UI thread.
113 void RegisterRequestHandler(const HandleRequestCallback& callback); 123 void RegisterRequestHandler(const HandleRequestCallback& callback);
114 124
115 private: 125 private:
116 // Initializes and starts the server. If initialization succeeds, Starts() 126 // Initializes and starts the server. If initialization succeeds, Starts()
117 // will return true. 127 // will return true.
118 void InitializeOnIOThread(); 128 void InitializeOnIOThread();
119 129
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 163
154 base::ThreadChecker thread_checker_; 164 base::ThreadChecker thread_checker_;
155 165
156 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); 166 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer);
157 }; 167 };
158 168
159 } // namespace test_servers 169 } // namespace test_servers
160 } // namespace net 170 } // namespace net
161 171
162 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ 172 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698