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

Side by Side Diff: ios/web/public/test/response_providers/response_provider.mm

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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ios/web/public/test/response_providers/response_provider.h" 5 #include "ios/web/public/test/response_providers/response_provider.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 9
10 namespace web { 10 namespace web {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 // static 46 // static
47 scoped_refptr<net::HttpResponseHeaders> 47 scoped_refptr<net::HttpResponseHeaders>
48 ResponseProvider::GetDefaultResponseHeaders() { 48 ResponseProvider::GetDefaultResponseHeaders() {
49 return GetResponseHeaders("text/html", net::HTTP_OK); 49 return GetResponseHeaders("text/html", net::HTTP_OK);
50 } 50 }
51 51
52 // static 52 // static
53 scoped_refptr<net::HttpResponseHeaders> 53 scoped_refptr<net::HttpResponseHeaders>
54 ResponseProvider::GetDefaultResponseHeaders(const std::string& cookie) {
55 scoped_refptr<net::HttpResponseHeaders> result = GetDefaultResponseHeaders();
56 result->AddCookie(cookie);
57 return result;
58 }
59
60 // static
61 scoped_refptr<net::HttpResponseHeaders>
54 ResponseProvider::GetRedirectResponseHeaders( 62 ResponseProvider::GetRedirectResponseHeaders(
55 const std::string& destination, 63 const std::string& destination,
56 const net::HttpStatusCode& http_status) { 64 const net::HttpStatusCode& http_status) {
57 scoped_refptr<net::HttpResponseHeaders> headers( 65 scoped_refptr<net::HttpResponseHeaders> headers(
58 GetResponseHeaders("text/html", http_status)); 66 GetResponseHeaders("text/html", http_status));
59 headers->AddHeader("Location: " + destination); 67 headers->AddHeader("Location: " + destination);
60 return headers; 68 return headers;
61 } 69 }
62 70
63 } // namespace web 71 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698