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

Side by Side Diff: ios/web/public/test/response_providers/html_response_provider_impl.h

Issue 2283203003: Implement simple http server with set cookie functionality. (Closed)
Patch Set: Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_ 5 #ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_
6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_ 6 #define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 21 matching lines...) Expand all
32 std::string body; 32 std::string body;
33 scoped_refptr<net::HttpResponseHeaders> headers; 33 scoped_refptr<net::HttpResponseHeaders> headers;
34 }; 34 };
35 // Constructs an HtmlResponseProviderImpl that does not respond to any 35 // Constructs an HtmlResponseProviderImpl that does not respond to any
36 // request. 36 // request.
37 HtmlResponseProviderImpl(); 37 HtmlResponseProviderImpl();
38 // Constructs an HtmlResponseProviderImpl that generates a simple string 38 // Constructs an HtmlResponseProviderImpl that generates a simple string
39 // response to a URL based on the mapping present in |responses|. 39 // response to a URL based on the mapping present in |responses|.
40 explicit HtmlResponseProviderImpl( 40 explicit HtmlResponseProviderImpl(
41 const std::map<GURL, std::string>& responses); 41 const std::map<GURL, std::string>& responses);
42 // Constructs an HtmlResponseProviderImpl that generates a simple string
43 // response to a URL based on the mapping present in |responses| and |cookie|.
44 explicit HtmlResponseProviderImpl(
45 const std::map<GURL, std::string>& responses,
46 const std::string& cookie);
42 // Constructs an HtmlResponseProviderImpl that generates a response to a URL 47 // Constructs an HtmlResponseProviderImpl that generates a response to a URL
43 // based on the mapping present in |responses|. 48 // based on the mapping present in |responses|.
44 explicit HtmlResponseProviderImpl(const std::map<GURL, Response>& responses); 49 explicit HtmlResponseProviderImpl(const std::map<GURL, Response>& responses);
45 50
46 virtual ~HtmlResponseProviderImpl(); 51 virtual ~HtmlResponseProviderImpl();
47 52
48 // Creates a reponse based on a redirect to |destination_url|. 53 // Creates a reponse based on a redirect to |destination_url|.
49 static HtmlResponseProviderImpl::Response GetRedirectResponse( 54 static HtmlResponseProviderImpl::Response GetRedirectResponse(
50 const GURL& destination_url, 55 const GURL& destination_url,
51 const net::HttpStatusCode& http_status); 56 const net::HttpStatusCode& http_status);
52 57
53 // Creates a response with |net::HTTP_OK|. 58 // Creates a response with |net::HTTP_OK|.
54 static HtmlResponseProviderImpl::Response GetSimpleResponse( 59 static HtmlResponseProviderImpl::Response GetSimpleResponse(
55 const std::string& body); 60 const std::string& body);
56 61
57 // Returns true if the request can be handled. 62 // Returns true if the request can be handled.
58 bool CanHandleRequest(const web::ResponseProvider::Request& request); 63 bool CanHandleRequest(const web::ResponseProvider::Request& request);
59 // Returns the headers and the response body. 64 // Returns the headers and the response body.
60 void GetResponseHeadersAndBody( 65 void GetResponseHeadersAndBody(
61 const web::ResponseProvider::Request& request, 66 const web::ResponseProvider::Request& request,
62 scoped_refptr<net::HttpResponseHeaders>* headers, 67 scoped_refptr<net::HttpResponseHeaders>* headers,
63 std::string* response_body); 68 std::string* response_body);
64 69
65 private: 70 private:
66 const std::map<GURL, Response> responses_; 71 const std::map<GURL, Response> responses_;
67 }; 72 };
68 73
69 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_ 74 #endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTML_RESPONSE_PROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698