Commit 1eac7d31 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Make signin tests use two argument ResponseHeader manipulation calls

We want to get rid of the single argument AddHeader() method as the two
argument AddHeader() and SetHeader() methods are safer and more flexible.

Bug: 1068194
Change-Id: Iffa9b5356aae762fad68a2d309eec94cf0a43568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147692
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Auto-Submit: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758829}
parent 3cccc8fc
...@@ -68,7 +68,7 @@ class TestResponseAdapter : public signin::ResponseAdapter, ...@@ -68,7 +68,7 @@ class TestResponseAdapter : public signin::ResponseAdapter,
bool is_main_frame) bool is_main_frame)
: is_main_frame_(is_main_frame), : is_main_frame_(is_main_frame),
headers_(new net::HttpResponseHeaders(std::string())) { headers_(new net::HttpResponseHeaders(std::string())) {
headers_->AddHeader(header_name + ": " + header_value); headers_->SetHeader(header_name, header_value);
} }
~TestResponseAdapter() override {} ~TestResponseAdapter() override {}
......
...@@ -253,13 +253,13 @@ TEST_F(ChromeSigninProxyingURLLoaderFactoryTest, ModifyHeaders) { ...@@ -253,13 +253,13 @@ TEST_F(ChromeSigninProxyingURLLoaderFactoryTest, ModifyHeaders) {
auto redirect_head = network::mojom::URLResponseHead::New(); auto redirect_head = network::mojom::URLResponseHead::New();
redirect_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(""); redirect_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
redirect_head->headers->AddHeader("X-Response-1: Foo"); redirect_head->headers->SetHeader("X-Response-1", "Foo");
redirect_head->headers->AddHeader("X-Response-2: Bar"); redirect_head->headers->SetHeader("X-Response-2", "Bar");
auto response_head = network::mojom::URLResponseHead::New(); auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(""); response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("X-Response-3: Foo"); response_head->headers->SetHeader("X-Response-3", "Foo");
response_head->headers->AddHeader("X-Response-4: Bar"); response_head->headers->SetHeader("X-Response-4", "Bar");
std::string body("Hello."); std::string body("Hello.");
network::URLLoaderCompletionStatus status; network::URLLoaderCompletionStatus status;
status.decoded_body_length = body.size(); status.decoded_body_length = body.size();
......
...@@ -167,8 +167,8 @@ TEST(ChromeSigninURLLoaderThrottleTest, Intercept) { ...@@ -167,8 +167,8 @@ TEST(ChromeSigninURLLoaderThrottleTest, Intercept) {
auto response_head = network::mojom::URLResponseHead::New(); auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(""); response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("X-Response-1: Foo"); response_head->headers->SetHeader("X-Response-1", "Foo");
response_head->headers->AddHeader("X-Response-2: Bar"); response_head->headers->SetHeader("X-Response-2", "Bar");
std::vector<std::string> request_headers_to_remove; std::vector<std::string> request_headers_to_remove;
net::HttpRequestHeaders modified_request_headers; net::HttpRequestHeaders modified_request_headers;
...@@ -211,8 +211,8 @@ TEST(ChromeSigninURLLoaderThrottleTest, Intercept) { ...@@ -211,8 +211,8 @@ TEST(ChromeSigninURLLoaderThrottleTest, Intercept) {
response_head = network::mojom::URLResponseHead::New(); response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(""); response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("X-Response-3: Foo"); response_head->headers->SetHeader("X-Response-3", "Foo");
response_head->headers->AddHeader("X-Response-4: Bar"); response_head->headers->SetHeader("X-Response-4", "Bar");
throttle->WillProcessResponse(kTestRedirectURL, response_head.get(), &defer); throttle->WillProcessResponse(kTestRedirectURL, response_head.get(), &defer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment