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

Side by Side Diff: ios/web/public/test/http_server_util.h

Issue 2291393003: Add capability to simple http server to bound Set-Cookie to URLs. (Closed)
Patch Set: Addressed comments from Peter 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
« no previous file with comments | « no previous file | ios/web/public/test/http_server_util.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_HTTP_SERVER_UTIL_H_ 5 #ifndef IOS_WEB_PUBLIC_TEST_HTTP_SERVER_UTIL_H_
6 #define IOS_WEB_PUBLIC_TEST_HTTP_SERVER_UTIL_H_ 6 #define IOS_WEB_PUBLIC_TEST_HTTP_SERVER_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace web { 12 namespace web {
13 13
14 class ResponseProvider; 14 class ResponseProvider;
15 15
16 namespace test { 16 namespace test {
17 17
18 // Sets up a web::test::HttpServer with a simple HtmlResponseProvider. The 18 // Sets up a web::test::HttpServer with a simple HtmlResponseProvider. The
19 // HtmlResponseProvider will use the |responses| map to resolve URLs. 19 // HtmlResponseProvider will use the |responses| map to resolve URLs.
20 void SetUpSimpleHttpServer(const std::map<GURL, std::string>& responses); 20 void SetUpSimpleHttpServer(const std::map<GURL, std::string>& responses);
21 21
22 // Sets up a web::test::HttpServer with a simple HtmlResponseProvider. The 22 // Sets up a web::test::HttpServer with a simple HtmlResponseProvider. The
23 // HtmlResponseProvider will use the |responses| map to resolve URLs and include 23 // HtmlResponseProvider will use the |responses| map to resolve URLs. The value
24 // Set-Cookie:|cookie| in the header. 24 // of |responses| is the cookie and response body pair where the first string is
25 void SetUpSimpleHttpServerWithSetCookie( 25 // the cookie and the second string is the response body. Set the cookie string
26 const std::map<GURL, std::string>& responses, 26 // as empty string if cookie is not needed in the response headers.
27 const std::string& cookie); 27 void SetUpSimpleHttpServerWithSetCookies(
28 const std::map<GURL, std::pair<std::string, std::string>>& responses);
28 29
29 // Sets up a web::test::HttpServer with a FileBasedResponseProvider. The 30 // Sets up a web::test::HttpServer with a FileBasedResponseProvider. The
30 // server will try to resolve URLs as file paths relative to the application 31 // server will try to resolve URLs as file paths relative to the application
31 // bundle path. web::test::MakeUrl should be used to rewrite URLs before doing 32 // bundle path. web::test::MakeUrl should be used to rewrite URLs before doing
32 // a request. 33 // a request.
33 void SetUpFileBasedHttpServer(); 34 void SetUpFileBasedHttpServer();
34 35
35 // Sets up a web::test::HttpServer with a single custom provider. 36 // Sets up a web::test::HttpServer with a single custom provider.
36 // Takes ownership of the provider. 37 // Takes ownership of the provider.
37 void SetUpHttpServer(std::unique_ptr<web::ResponseProvider> provider); 38 void SetUpHttpServer(std::unique_ptr<web::ResponseProvider> provider);
38 39
39 // Adds a single custom provider. 40 // Adds a single custom provider.
40 // Takes ownership of the provider. 41 // Takes ownership of the provider.
41 void AddResponseProvider(std::unique_ptr<web::ResponseProvider> provider); 42 void AddResponseProvider(std::unique_ptr<web::ResponseProvider> provider);
42 } // namespace test 43 } // namespace test
43 } // namespace web 44 } // namespace web
44 45
45 #endif // IOS_WEB_PUBLIC_TEST_HTTP_SERVER_UTIL_H_ 46 #endif // IOS_WEB_PUBLIC_TEST_HTTP_SERVER_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | ios/web/public/test/http_server_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698