Chromium Code Reviews| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 // Returns the base URL to the server, which looks like | 122 // Returns the base URL to the server, which looks like |
| 123 // http://127.0.0.1:<port>/, where <port> is the actual port number used by | 123 // http://127.0.0.1:<port>/, where <port> is the actual port number used by |
| 124 // the server. | 124 // the server. |
| 125 const GURL& base_url() const { return base_url_; } | 125 const GURL& base_url() const { return base_url_; } |
| 126 | 126 |
| 127 // Returns a URL to the server based on the given relative URL, which | 127 // Returns a URL to the server based on the given relative URL, which |
| 128 // should start with '/'. For example: GetURL("/path?query=foo") => | 128 // should start with '/'. For example: GetURL("/path?query=foo") => |
| 129 // http://127.0.0.1:<port>/path?query=foo. | 129 // http://127.0.0.1:<port>/path?query=foo. |
| 130 GURL GetURL(const std::string& relative_url) const; | 130 GURL GetURL(const std::string& relative_url) const; |
| 131 | 131 |
| 132 // Similar to the above method with the difference that it uses the supplied | |
| 133 // |hostname| for the URL instead of 127.0.0.1. | |
|
mtomasz
2014/10/30 00:25:29
nit: Could you add a comment, that the hostname sh
nasko
2014/10/30 00:45:11
Done.
| |
| 134 GURL GetURL(const std::string& hostname, const std::string& relative_url); | |
|
mtomasz
2014/10/30 00:25:29
nit: This method should be const.
nasko
2014/10/30 00:45:11
Done.
| |
| 135 | |
| 132 // Returns the port number used by the server. | 136 // Returns the port number used by the server. |
| 133 int port() const { return port_; } | 137 int port() const { return port_; } |
| 134 | 138 |
| 135 // Registers request handler which serves files from |directory|. | 139 // Registers request handler which serves files from |directory|. |
| 136 // For instance, a request to "/foo.html" is served by "foo.html" under | 140 // For instance, a request to "/foo.html" is served by "foo.html" under |
| 137 // |directory|. Files under sub directories are also handled in the same way | 141 // |directory|. Files under sub directories are also handled in the same way |
| 138 // (i.e. "/foo/bar.html" is served by "foo/bar.html" under |directory|). | 142 // (i.e. "/foo/bar.html" is served by "foo/bar.html" under |directory|). |
| 139 void ServeFilesFromDirectory(const base::FilePath& directory); | 143 void ServeFilesFromDirectory(const base::FilePath& directory); |
| 140 | 144 |
| 141 // The most general purpose method. Any request processing can be added using | 145 // The most general purpose method. Any request processing can be added using |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // invalidate its weak pointers before any other members are destroyed. | 201 // invalidate its weak pointers before any other members are destroyed. |
| 198 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; | 202 base::WeakPtrFactory<EmbeddedTestServer> weak_factory_; |
| 199 | 203 |
| 200 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); | 204 DISALLOW_COPY_AND_ASSIGN(EmbeddedTestServer); |
| 201 }; | 205 }; |
| 202 | 206 |
| 203 } // namespace test_servers | 207 } // namespace test_servers |
| 204 } // namespace net | 208 } // namespace net |
| 205 | 209 |
| 206 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ | 210 #endif // NET_TEST_EMBEDDED_TEST_SERVER_EMBEDDED_TEST_SERVER_H_ |
| OLD | NEW |