Commit 97e9b821 authored by Robert Ogden's avatar Robert Ogden Committed by Chromium LUCI CQ

Remove UseCustomProxyForNavigationAndRenderFrameRequest test

While this test was disabled due to a flake, the code under test was
removed.

Code and test added:
https://chromium-review.googlesource.com/c/chromium/src/+/1589011

Code removed:
https://chromium-review.googlesource.com/c/chromium/src/+/2101318

Bug: 991035
Change-Id: Ic2ab95718fc8e2772ead0bdbfe69acb3058b63be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2593179Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837224}
parent 670be8ad
...@@ -165,8 +165,6 @@ namespace { ...@@ -165,8 +165,6 @@ namespace {
using ::testing::Optional; using ::testing::Optional;
constexpr char kMockHost[] = "mock.host"; constexpr char kMockHost[] = "mock.host";
constexpr char kCustomProxyResponse[] = "CustomProxyResponse";
constexpr int kProcessId = 11;
constexpr int kRouteId = 12; constexpr int kRouteId = 12;
#if BUILDFLAG(ENABLE_REPORTING) #if BUILDFLAG(ENABLE_REPORTING)
...@@ -254,13 +252,6 @@ std::unique_ptr<TestURLLoaderClient> FetchRequest( ...@@ -254,13 +252,6 @@ std::unique_ptr<TestURLLoaderClient> FetchRequest(
return client; return client;
} }
std::unique_ptr<net::test_server::HttpResponse> CustomProxyResponse(
const net::test_server::HttpRequest& request) {
auto response = std::make_unique<net::test_server::BasicHttpResponse>();
response->set_content(kCustomProxyResponse);
return std::move(response);
}
// proxy_resolver::mojom::ProxyResolverFactory that captures the most recent PAC // proxy_resolver::mojom::ProxyResolverFactory that captures the most recent PAC
// script passed to it, and the most recent URL/NetworkIsolationKey passed to // script passed to it, and the most recent URL/NetworkIsolationKey passed to
// the GetProxyForUrl() method of proxy_resolver::mojom::ProxyResolver it // the GetProxyForUrl() method of proxy_resolver::mojom::ProxyResolver it
...@@ -5742,70 +5733,6 @@ TEST_F(NetworkContextMockHostTest, MAYBE_CustomProxyUsesSpecifiedProxyList) { ...@@ -5742,70 +5733,6 @@ TEST_F(NetworkContextMockHostTest, MAYBE_CustomProxyUsesSpecifiedProxyList) {
ConvertToProxyServer(proxy_test_server)); ConvertToProxyServer(proxy_test_server));
} }
// Verifies that custom proxy is used only for requests with process id and
// render frame id.
// TODO(https://crbug.com/991035): Crash flakes due to NetworkService'
// UploadLoadInfo() timer firing during FetchRequest().
TEST_F(NetworkContextMockHostTest,
DISABLED_UseCustomProxyForNavigationAndRenderFrameRequest) {
net::EmbeddedTestServer test_server;
net::test_server::RegisterDefaultHandlers(&test_server);
ASSERT_TRUE(test_server.Start());
net::EmbeddedTestServer proxy_test_server;
proxy_test_server.RegisterRequestHandler(
base::BindRepeating(&CustomProxyResponse));
ASSERT_TRUE(proxy_test_server.Start());
struct TestCase {
int process_id;
int render_frame_id;
bool expected_custom_proxy_used;
};
const TestCase test_cases[] = {
// When process id and renderer id are invalid, custom proxy is not used.
{0, MSG_ROUTING_NONE, false},
{kProcessId, kRouteId, true},
{0, kRouteId, true},
{kProcessId, MSG_ROUTING_NONE, true},
// render_frame_id = MSG_ROUTING_CONTROL provides a temporary way to use
// the custom proxy for specific requests.
{0, MSG_ROUTING_CONTROL, true},
};
for (const TestCase& test_case : test_cases) {
mojo::Remote<mojom::CustomProxyConfigClient> proxy_config_client;
mojom::NetworkContextParamsPtr context_params = CreateContextParams();
context_params->custom_proxy_config_client_receiver =
proxy_config_client.BindNewPipeAndPassReceiver();
std::unique_ptr<NetworkContext> network_context =
CreateContextWithParams(std::move(context_params));
auto config = mojom::CustomProxyConfig::New();
net::ProxyServer proxy_server = ConvertToProxyServer(proxy_test_server);
config->rules.ParseFromString("http=" + proxy_server.ToURI());
proxy_config_client->OnCustomProxyConfigUpdated(std::move(config));
task_environment_.RunUntilIdle();
ResourceRequest request;
request.url = GetURLWithMockHost(test_server, "/echo");
request.render_frame_id = test_case.render_frame_id;
std::unique_ptr<TestURLLoaderClient> client =
FetchRequest(request, network_context.get(), mojom::kURLLoadOptionNone,
test_case.process_id);
task_environment_.RunUntilIdle();
std::string response;
EXPECT_TRUE(
mojo::BlockingCopyToString(client->response_body_release(), &response));
if (test_case.expected_custom_proxy_used)
EXPECT_EQ(kCustomProxyResponse, response);
else
EXPECT_EQ("Echo", response);
}
}
TEST_F(NetworkContextTest, MaximumCount) { TEST_F(NetworkContextTest, MaximumCount) {
net::EmbeddedTestServer test_server; net::EmbeddedTestServer test_server;
test_server.AddDefaultHandlers( test_server.AddDefaultHandlers(
......
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