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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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_HTTP_RESPONSE_H_ 5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_
6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_ 6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 // in response. If you intend to make this a valid HTTP response, 25 // in response. If you intend to make this a valid HTTP response,
26 // it should start with "HTTP/x.x" line, followed by response headers. 26 // it should start with "HTTP/x.x" line, followed by response headers.
27 virtual std::string ToResponseString() const = 0; 27 virtual std::string ToResponseString() const = 0;
28 }; 28 };
29 29
30 // This class is used to handle basic HTTP responses with commonly used 30 // This class is used to handle basic HTTP responses with commonly used
31 // response headers such as "Content-Type". 31 // response headers such as "Content-Type".
32 class BasicHttpResponse : public HttpResponse { 32 class BasicHttpResponse : public HttpResponse {
33 public: 33 public:
34 BasicHttpResponse(); 34 BasicHttpResponse();
35 virtual ~BasicHttpResponse(); 35 ~BasicHttpResponse() override;
36 36
37 // The response code. 37 // The response code.
38 HttpStatusCode code() const { return code_; } 38 HttpStatusCode code() const { return code_; }
39 void set_code(HttpStatusCode code) { code_ = code; } 39 void set_code(HttpStatusCode code) { code_ = code; }
40 40
41 // The content of the response. 41 // The content of the response.
42 const std::string& content() const { return content_; } 42 const std::string& content() const { return content_; }
43 void set_content(const std::string& content) { content_ = content; } 43 void set_content(const std::string& content) { content_ = content; }
44 44
45 // The content type. 45 // The content type.
46 const std::string& content_type() const { return content_type_; } 46 const std::string& content_type() const { return content_type_; }
47 void set_content_type(const std::string& content_type) { 47 void set_content_type(const std::string& content_type) {
48 content_type_ = content_type; 48 content_type_ = content_type;
49 } 49 }
50 50
51 // Adds a custom header. 51 // Adds a custom header.
52 void AddCustomHeader(const std::string& key, const std::string& value) { 52 void AddCustomHeader(const std::string& key, const std::string& value) {
53 custom_headers_.push_back(std::make_pair(key, value)); 53 custom_headers_.push_back(std::make_pair(key, value));
54 } 54 }
55 55
56 // Generates and returns a http response string. 56 // Generates and returns a http response string.
57 virtual std::string ToResponseString() const override; 57 std::string ToResponseString() const override;
58 58
59 private: 59 private:
60 HttpStatusCode code_; 60 HttpStatusCode code_;
61 std::string content_; 61 std::string content_;
62 std::string content_type_; 62 std::string content_type_;
63 std::vector<std::pair<std::string, std::string> > custom_headers_; 63 std::vector<std::pair<std::string, std::string> > custom_headers_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(BasicHttpResponse); 65 DISALLOW_COPY_AND_ASSIGN(BasicHttpResponse);
66 }; 66 };
67 67
68 } // namespace test_server 68 } // namespace test_server
69 } // namespace net 69 } // namespace net
70 70
71 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_ 71 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server_unittest.cc ('k') | net/test/net_test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698