Commit 2a3175de authored by Pavel Feldman's avatar Pavel Feldman Committed by Commit Bot

Headless: don't override user agent from headless embedder, we are walking away from that.

Change-Id: I1411429de9f3bb92eae22c6911a4caeb4a2932f7
TBR: eseckler
Reviewed-on: https://chromium-review.googlesource.com/1071874
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561557}
parent 89d0b86d
...@@ -64,16 +64,11 @@ void GenericURLRequestJob::SetExtraRequestHeaders( ...@@ -64,16 +64,11 @@ void GenericURLRequestJob::SetExtraRequestHeaders(
const net::HttpUserAgentSettings* user_agent_settings = const net::HttpUserAgentSettings* user_agent_settings =
request()->context()->http_user_agent_settings(); request()->context()->http_user_agent_settings();
// If set the |user_agent_settings| accept language is a fallback.
if (user_agent_settings) { if (user_agent_settings) {
// If set the |user_agent_settings| accept language is a fallback.
extra_request_headers_.SetHeaderIfMissing( extra_request_headers_.SetHeaderIfMissing(
net::HttpRequestHeaders::kAcceptLanguage, net::HttpRequestHeaders::kAcceptLanguage,
user_agent_settings->GetAcceptLanguage()); user_agent_settings->GetAcceptLanguage());
// If set the |user_agent_settings| user agent is an override.
if (!user_agent_settings->GetUserAgent().empty()) {
extra_request_headers_.SetHeader(net::HttpRequestHeaders::kUserAgent,
user_agent_settings->GetUserAgent());
}
} }
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_bytes_element_reader.h"
#include "net/http/http_response_headers.h" #include "net/http/http_response_headers.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/static_http_user_agent_settings.h"
#include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_factory_impl.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -252,7 +251,6 @@ class GenericURLRequestJobTest : public testing::Test { ...@@ -252,7 +251,6 @@ class GenericURLRequestJobTest : public testing::Test {
}; };
TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) { TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) {
net::StaticHttpUserAgentSettings user_agent_settings("en-UK", "TestBrowser");
json_fetch_reply_map_["https://example.com/"] = R"( json_fetch_reply_map_["https://example.com/"] = R"(
{ {
...@@ -263,7 +261,6 @@ TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) { ...@@ -263,7 +261,6 @@ TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) {
} }
})"; })";
url_request_context_.set_http_user_agent_settings(&user_agent_settings);
std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest( std::unique_ptr<net::URLRequest> request(url_request_context_.CreateRequest(
GURL("https://example.com"), net::DEFAULT_PRIORITY, &request_delegate_, GURL("https://example.com"), net::DEFAULT_PRIORITY, &request_delegate_,
TRAFFIC_ANNOTATION_FOR_TESTS)); TRAFFIC_ANNOTATION_FOR_TESTS));
...@@ -277,10 +274,8 @@ TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) { ...@@ -277,10 +274,8 @@ TEST_F(GenericURLRequestJobTest, BasicGetRequestParams) {
"url": "https://example.com/", "url": "https://example.com/",
"method": "GET", "method": "GET",
"headers": { "headers": {
"Accept-Language": "en-UK",
"Extra-Header": "Value", "Extra-Header": "Value",
"Referer": "https://referrer.example.com/", "Referer": "https://referrer.example.com/"
"User-Agent": "TestBrowser"
} }
})"; })";
......
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