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

Side by Side Diff: chrome/browser/google_apis/test_server/http_response.h

Issue 11275306: Revert 167627 - HTTP server for testing Google APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12
13 namespace drive {
14 namespace test_server {
15
16 enum ResponseCode {
17 SUCCESS = 200,
18 MOVED = 301,
19 NOT_FOUND = 404,
20 ACCESS_DENIED = 500,
21 };
22
23 // Respresents a HTTP response. Since it can be big, it may be better to use
24 // scoped_ptr to pass it instead of copying.
25 class HttpResponse {
26 public:
27 HttpResponse();
28 ~HttpResponse();
29
30 // The response code.
31 ResponseCode code() const { return code_; }
32 void set_code(ResponseCode code) { code_ = code; }
33
34 // The content of the response.
35 const std::string& content() const { return content_; }
36 void set_content(const std::string& content) { content_ = content; }
37
38 // The content type.
39 const std::string& content_type() const { return content_type_; }
40 void set_content_type(const std::string& content_type) {
41 content_type_ = content_type;
42 }
43
44 // The custom headers to be sent to the client.
45 const std::map<std::string, std::string>& custom_headers() const {
46 return custom_headers_;
47 }
48
49 // Adds a custom header.
50 void AddCustomHeader(const std::string& key, const std::string& value) {
51 custom_headers_[key] = value;
52 }
53
54 // Generates and returns a http response string.
55 std::string ToResponseString() const;
56
57 private:
58 ResponseCode code_;
59 std::string content_;
60 std::string content_type_;
61 std::map<std::string, std::string> custom_headers_;
62 };
63
64 } // namespace test_servers
65 } // namespace drive
66
67 #endif // CHROME_BROWSER_GOOGLE_APIS_TEST_SERVER_HTTP_RESPONSE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698