Commit 698b9f04 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Make Chrome OS 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: Id41cbb7a1ced299610f60a4a0be691fdebf8b044
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148026
Auto-Submit: Matt Menke <mmenke@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760096}
parent 2cd5dc79
......@@ -252,7 +252,7 @@ class ServicesCustomizationDocumentTest : public testing::Test {
auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("Content-Type: application/json");
response_head->headers->SetHeader("Content-Type", "application/json");
loader_factory_.AddResponse(url, std::move(response_head), manifest,
network::URLLoaderCompletionStatus(net::OK));
EXPECT_CALL(*interceptor_, Intercept).Times(Exactly(1));
......@@ -264,7 +264,7 @@ class ServicesCustomizationDocumentTest : public testing::Test {
auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("Content-Type: application/json");
response_head->headers->SetHeader("Content-Type", "application/json");
response_head->headers->ReplaceStatusLine("HTTP/1.1 404 Not found");
loader_factory_.AddResponse(url, std::move(response_head), std::string(),
network::URLLoaderCompletionStatus(net::OK));
......
......@@ -117,7 +117,7 @@ class TestGeolocationAPILoaderFactory : public network::TestURLLoaderFactory {
void AddResponseWithCode(int error_code) {
auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("Content-Type: application/json");
response_head->headers->SetHeader("Content-Type", "application/json");
// If AddResponse() is called multiple times for the same URL, the last
// one is the one used so there is no need for ClearResponses().
AddResponse(url_, std::move(response_head), response_,
......
......@@ -115,7 +115,7 @@ class TestTimeZoneAPILoaderFactory : public network::TestURLLoaderFactory {
void AddResponseWithCode(int error_code) {
auto response_head = network::mojom::URLResponseHead::New();
response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>("");
response_head->headers->AddHeader("Content-Type: application/json");
response_head->headers->SetHeader("Content-Type", "application/json");
// If AddResponse() is called multiple times for the same URL, the last
// one is the one used so there is no need for ClearResponses().
AddResponse(url_, std::move(response_head), response_,
......
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