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

Unified Diff: net/test/embedded_test_server/http_response.h

Issue 15505003: GTTF: Convert most tests in content to use EmbeddedTestServer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang 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 side-by-side diff with in-line comments
Download patch
Index: net/test/embedded_test_server/http_response.h
diff --git a/net/test/embedded_test_server/http_response.h b/net/test/embedded_test_server/http_response.h
index b597ccebc13639d4b16a3bd0578732212550f4c2..141c8cb027ef3186eb960f705807461ee2201d88 100644
--- a/net/test/embedded_test_server/http_response.h
+++ b/net/test/embedded_test_server/http_response.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
namespace net {
namespace test_server {
@@ -24,12 +25,23 @@ enum ResponseCode {
ACCESS_DENIED = 500,
};
-// Respresents a HTTP response. Since it can be big, it may be better to use
-// scoped_ptr to pass it instead of copying.
-class HttpResponse {
+// Interface for HTTP response implementations.
+class HttpResponse{
public:
- HttpResponse();
- ~HttpResponse();
+ virtual ~HttpResponse();
+
+ // Returns raw contents to be written to the network socket
+ // in response. If you intend to make this a valid HTTP response,
+ // it should start with "HTTP/x.x" line, followed by response headers.
+ virtual std::string ToResponseString() const = 0;
+};
+
+// This class is used to handle basic HTTP responses with commonly used
+// response headers such as "Content-Type".
+class BasicHttpResponse : public HttpResponse {
+ public:
+ BasicHttpResponse();
+ virtual ~BasicHttpResponse();
// The response code.
ResponseCode code() const { return code_; }
@@ -56,13 +68,15 @@ class HttpResponse {
}
// Generates and returns a http response string.
- std::string ToResponseString() const;
+ virtual std::string ToResponseString() const OVERRIDE;
private:
ResponseCode code_;
std::string content_;
std::string content_type_;
std::map<std::string, std::string> custom_headers_;
+
+ DISALLOW_COPY_AND_ASSIGN(BasicHttpResponse);
};
} // namespace test_server
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server_unittest.cc ('k') | net/test/embedded_test_server/http_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698