Commit ae10116c authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Fix SecurityExploitBrowserTest to use network service path

These tests were accessing ResourceMessageFilter directly, instead of
using the network service path when it is enabled.

Bug: 862176, 874227
Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: I3add3b588ad40c3bca265ad68adccca293ddae0d
Reviewed-on: https://chromium-review.googlesource.com/1175105Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583117}
parent 8711d1bf
......@@ -444,7 +444,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
friend class ChildProcessLauncherBrowserTest_ChildSpawnFail_Test;
friend class VisitRelayingRenderProcessHost;
friend class StoragePartitonInterceptor;
friend class SecurityExploitBrowserTest;
class ConnectionFilterController;
class ConnectionFilterImpl;
......
......@@ -14,7 +14,6 @@
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/loader/resource_message_filter.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
......@@ -50,6 +49,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/url_request/url_request_slow_download_job.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
......@@ -182,20 +182,6 @@ class SecurityExploitBrowserTest : public ContentBrowserTest {
base::BindOnce(&net::URLRequestSlowDownloadJob::AddUrlHandler));
}
static void CreateLoaderAndStartOnIOThread(
scoped_refptr<ResourceMessageFilter> filter,
network::mojom::URLLoaderRequest request,
int route_id,
int request_id,
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtrInfo client) {
filter->CreateLoaderAndStart(
std::move(request), route_id, request_id,
network::mojom::kURLLoadOptionNone, resource_request,
network::mojom::URLLoaderClientPtr(std::move(client)),
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
}
static void CreateLoaderAndStart(
RenderProcessHost* process,
int route_id,
......@@ -215,13 +201,13 @@ class SecurityExploitBrowserTest : public ContentBrowserTest {
int request_id,
const network::ResourceRequest& resource_request,
network::mojom::URLLoaderClientPtrInfo client) {
RenderProcessHostImpl* impl = static_cast<RenderProcessHostImpl*>(process);
auto filter = impl->resource_message_filter_;
process->GetChannel()->ipc_task_runner()->PostTask(
FROM_HERE, base::BindOnce(CreateLoaderAndStartOnIOThread, filter,
std::move(request), route_id, request_id,
resource_request, std::move(client)));
network::mojom::URLLoaderFactoryPtr factory;
process->CreateURLLoaderFactory(mojo::MakeRequest(&factory));
factory->CreateLoaderAndStart(
std::move(request), route_id, request_id,
network::mojom::kURLLoadOptionNone, resource_request,
network::mojom::URLLoaderClientPtr(std::move(client)),
net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
}
void TryCreateDuplicateRequestIds(Shell* shell, bool block_loaders) {
......@@ -529,11 +515,21 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidOriginHeaders) {
// Renderer process should not be able to create multiple requests with the same
// id.
IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidRequestId) {
// This test is specific to the ResourceDispatcherHost implementation, which
// is not used with network service enabled.
if (base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
// Existing loader in pending_loaders_.
TryCreateDuplicateRequestIds(shell(), false);
}
IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, InvalidBlockedRequestId) {
// This test is specific to the ResourceDispatcherHost implementation, which
// is not used with network service enabled.
if (base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
// Existing loader in blocked_loaders_map_.
TryCreateDuplicateRequestIds(shell(), true);
}
......
......@@ -6,7 +6,6 @@
# See https://crbug.com/769401
# Uncategorized timeouts or test failures.
-ExtensionUnloadBrowserTest.UnloadWithContentScripts
-ProxySettingsApiTest.ProxyEventsInvalidProxy
-RegisterProtocolHandlerBrowserTest.CustomHandler
-SubresourceFilterBrowserTest.FailedProvisionalLoadInMainframe
......@@ -200,6 +199,10 @@
-PlatformAppWithFileBrowserTest.LaunchNewFile
-SyncFileSystemApiTest.WriteFileThenGetUsage
# https://crbug.com/862176
# Requires checking Origin headers on requests made after extension unload.
-ExtensionUnloadBrowserTest.UnloadWithContentScripts
# NOTE: if adding an exclusion for an existing failure (e.g. additional test for
# feature X that is already not working), please add it beside the existing
# failures. Otherwise please reach out to network-service-dev@.
......@@ -37,6 +37,9 @@
# https://crbug.com/827318
-RenderThreadImplBrowserTest.NonResourceDispatchIPCTasksDontGoThroughScheduler
# https://crbug.com/862176
-SecurityExploitBrowserTest.InvalidOriginHeaders
# NOTE: if adding an exclusion for an existing failure (e.g. additional test for
# feature X that is already not working), please add it beside the existing
# failures. Otherwise please reach out to network-service-dev@.
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