Commit f265872d authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Move a couple test files from content/test to services/network.

These are testing private services/network/ classes, so should be in
services/network/.

Bug: None
Change-Id: I8f736112feb755c035e88570a180cc6debc128e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1907073Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714900}
parent ef2f4a29
...@@ -300,8 +300,6 @@ jumbo_static_library("test_support") { ...@@ -300,8 +300,6 @@ jumbo_static_library("test_support") {
"test_content_browser_client.h", "test_content_browser_client.h",
"test_content_client.cc", "test_content_client.cc",
"test_content_client.h", "test_content_client.h",
"test_mojo_proxy_resolver_factory.cc",
"test_mojo_proxy_resolver_factory.h",
"test_navigation_url_loader.cc", "test_navigation_url_loader.cc",
"test_navigation_url_loader.h", "test_navigation_url_loader.h",
"test_navigation_url_loader_delegate.cc", "test_navigation_url_loader_delegate.cc",
...@@ -1906,9 +1904,7 @@ test("content_unittests") { ...@@ -1906,9 +1904,7 @@ test("content_unittests") {
"../renderer/worker/worker_thread_registry_unittest.cc", "../renderer/worker/worker_thread_registry_unittest.cc",
"../test/renderer_audio_output_stream_factory_context_impl_unittest.cc", "../test/renderer_audio_output_stream_factory_context_impl_unittest.cc",
"navigation_simulator_unittest.cc", "navigation_simulator_unittest.cc",
"proxy_service_mojo_unittest.cc",
"test_render_frame_host_unittest.cc", "test_render_frame_host_unittest.cc",
"url_request_context_builder_mojo_unittest.cc",
] ]
if (is_mac) { if (is_mac) {
...@@ -2019,7 +2015,6 @@ test("content_unittests") { ...@@ -2019,7 +2015,6 @@ test("content_unittests") {
"//services/network:test_support", "//services/network:test_support",
"//services/network/public/cpp", "//services/network/public/cpp",
"//services/network/public/mojom", "//services/network/public/mojom",
"//services/proxy_resolver/:lib",
"//services/service_manager/public/cpp/test:test_support", "//services/service_manager/public/cpp/test:test_support",
"//services/video_capture/public/cpp:mocks", "//services/video_capture/public/cpp:mocks",
"//services/video_capture/public/mojom", "//services/video_capture/public/mojom",
......
...@@ -356,6 +356,10 @@ source_set("tests") { ...@@ -356,6 +356,10 @@ source_set("tests") {
if (!is_ios) { if (!is_ios) {
sources += [ sources += [
"proxy_resolver_factory_mojo_unittest.cc", "proxy_resolver_factory_mojo_unittest.cc",
"proxy_service_mojo_unittest.cc",
"test_mojo_proxy_resolver_factory.cc",
"test_mojo_proxy_resolver_factory.h",
"url_request_context_builder_mojo_unittest.cc",
"websocket_throttler_unittest.cc", "websocket_throttler_unittest.cc",
] ]
...@@ -408,6 +412,10 @@ source_set("tests") { ...@@ -408,6 +412,10 @@ source_set("tests") {
if (trial_comparison_cert_verifier_supported) { if (trial_comparison_cert_verifier_supported) {
sources += [ "trial_comparison_cert_verifier_mojo_unittest.cc" ] sources += [ "trial_comparison_cert_verifier_mojo_unittest.cc" ]
} }
if (!is_ios) {
deps += [ "//services/proxy_resolver:lib" ]
}
} }
jumbo_source_set("test_support") { jumbo_source_set("test_support") {
......
...@@ -21,3 +21,11 @@ include_rules = [ ...@@ -21,3 +21,11 @@ include_rules = [
"+third_party/boringssl/src/include", "+third_party/boringssl/src/include",
"+url", "+url",
] ]
specific_include_rules = {
# Some tests use a real proxy_resolver::ProxyResolverImpl.
"test_mojo_proxy_resolver_factory\.h": [
"+services/proxy_resolver/proxy_resolver_factory_impl.h",
],
}
\ No newline at end of file
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/test/test_mojo_proxy_resolver_factory.h"
#include "net/base/completion_once_callback.h" #include "net/base/completion_once_callback.h"
#include "net/base/network_delegate_impl.h" #include "net/base/network_delegate_impl.h"
#include "net/base/test_completion_callback.h" #include "net/base/test_completion_callback.h"
...@@ -31,6 +30,7 @@ ...@@ -31,6 +30,7 @@
#include "net/test/event_waiter.h" #include "net/test/event_waiter.h"
#include "net/test/gtest_util.h" #include "net/test/gtest_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/test_mojo_proxy_resolver_factory.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.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"
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
using net::test::IsOk; using net::test::IsOk;
namespace content { namespace network {
namespace { namespace {
...@@ -116,21 +116,20 @@ class ProxyServiceMojoTest : public testing::Test { ...@@ -116,21 +116,20 @@ class ProxyServiceMojoTest : public testing::Test {
mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4"); mock_host_resolver_.rules()->AddRule("example.com", "1.2.3.4");
fetcher_ = new net::MockPacFileFetcher; fetcher_ = new net::MockPacFileFetcher;
proxy_resolution_service_ = proxy_resolution_service_ = CreateProxyResolutionServiceUsingMojoFactory(
network::CreateProxyResolutionServiceUsingMojoFactory( proxy_resolver::mojom::ProxyResolverFactoryPtr(
proxy_resolver::mojom::ProxyResolverFactoryPtr( test_mojo_proxy_resolver_factory_.CreateFactoryRemote()),
test_mojo_proxy_resolver_factory_.CreateFactoryRemote()), std::make_unique<net::ProxyConfigServiceFixed>(
std::make_unique<net::ProxyConfigServiceFixed>( net::ProxyConfigWithAnnotation(
net::ProxyConfigWithAnnotation( net::ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl)),
net::ProxyConfig::CreateFromCustomPacURL(GURL(kPacUrl)), TRAFFIC_ANNOTATION_FOR_TESTS)),
TRAFFIC_ANNOTATION_FOR_TESTS)), base::WrapUnique(fetcher_),
base::WrapUnique(fetcher_), std::make_unique<net::DoNothingDhcpPacFileFetcher>(),
std::make_unique<net::DoNothingDhcpPacFileFetcher>(), &mock_host_resolver_, &net_log_, &network_delegate_);
&mock_host_resolver_, &net_log_, &network_delegate_);
} }
base::test::TaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
content::TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_; TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_;
TestNetworkDelegate network_delegate_; TestNetworkDelegate network_delegate_;
net::MockHostResolver mock_host_resolver_; net::MockHostResolver mock_host_resolver_;
// Owned by |proxy_resolution_service_|. // Owned by |proxy_resolution_service_|.
...@@ -234,4 +233,4 @@ TEST_F(ProxyServiceMojoTest, ErrorOnInitialization) { ...@@ -234,4 +233,4 @@ TEST_F(ProxyServiceMojoTest, ErrorOnInitialization) {
CheckCapturedNetLogEntries(net_log_.GetEntries()); CheckCapturedNetLogEntries(net_log_.GetEntries());
} }
} // namespace content } // namespace network
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/test/test_mojo_proxy_resolver_factory.h" #include "services/network/test_mojo_proxy_resolver_factory.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/logging.h" #include "base/logging.h"
namespace content { namespace network {
TestMojoProxyResolverFactory::TestMojoProxyResolverFactory() TestMojoProxyResolverFactory::TestMojoProxyResolverFactory()
: proxy_resolver_factory_impl_(factory_.BindNewPipeAndPassReceiver()) {} : proxy_resolver_factory_impl_(factory_.BindNewPipeAndPassReceiver()) {}
...@@ -30,4 +30,4 @@ TestMojoProxyResolverFactory::CreateFactoryRemote() { ...@@ -30,4 +30,4 @@ TestMojoProxyResolverFactory::CreateFactoryRemote() {
return receiver_.BindNewPipeAndPassRemote(); return receiver_.BindNewPipeAndPassRemote();
} }
} // namespace content } // namespace network
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_TEST_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ #ifndef SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
#define CONTENT_TEST_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ #define SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
#include <memory> #include <memory>
#include <string> #include <string>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "services/proxy_resolver/proxy_resolver_factory_impl.h" #include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" #include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
namespace content { namespace network {
// MojoProxyResolverFactory that runs PAC scripts in-process, for tests. // MojoProxyResolverFactory that runs PAC scripts in-process, for tests.
class TestMojoProxyResolverFactory class TestMojoProxyResolverFactory
...@@ -48,6 +48,6 @@ class TestMojoProxyResolverFactory ...@@ -48,6 +48,6 @@ class TestMojoProxyResolverFactory
DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory); DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory);
}; };
} // namespace content } // namespace network
#endif // CONTENT_TEST_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_ #endif // SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "content/test/test_mojo_proxy_resolver_factory.h"
#include "net/base/host_port_pair.h" #include "net/base/host_port_pair.h"
#include "net/proxy_resolution/proxy_config.h" #include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h" #include "net/proxy_resolution/proxy_config_service_fixed.h"
...@@ -20,6 +19,7 @@ ...@@ -20,6 +19,7 @@
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_test_util.h" #include "net/url_request/url_request_test_util.h"
#include "services/network/test_mojo_proxy_resolver_factory.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "services/network/mock_mojo_dhcp_wpad_url_client.h" #include "services/network/mock_mojo_dhcp_wpad_url_client.h"
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
namespace content { namespace network {
namespace { namespace {
...@@ -61,7 +61,7 @@ class URLRequestContextBuilderMojoTest : public PlatformTest { ...@@ -61,7 +61,7 @@ class URLRequestContextBuilderMojoTest : public PlatformTest {
base::test::TaskEnvironment task_environment_; base::test::TaskEnvironment task_environment_;
TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_; TestMojoProxyResolverFactory test_mojo_proxy_resolver_factory_;
net::EmbeddedTestServer test_server_; net::EmbeddedTestServer test_server_;
network::URLRequestContextBuilderMojo builder_; URLRequestContextBuilderMojo builder_;
}; };
TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) { TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) {
...@@ -78,9 +78,8 @@ TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) { ...@@ -78,9 +78,8 @@ TEST_F(URLRequestContextBuilderMojoTest, MojoProxyResolver) {
test_mojo_proxy_resolver_factory_.CreateFactoryRemote())); test_mojo_proxy_resolver_factory_.CreateFactoryRemote()));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
builder_.SetDhcpWpadUrlClient(network::mojom::DhcpWpadUrlClientPtr( builder_.SetDhcpWpadUrlClient(mojom::DhcpWpadUrlClientPtr(
network::MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver( MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver(std::string())));
std::string())));
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
std::unique_ptr<net::URLRequestContext> context(builder_.Build()); std::unique_ptr<net::URLRequestContext> context(builder_.Build());
...@@ -116,9 +115,8 @@ TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) { ...@@ -116,9 +115,8 @@ TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) {
test_mojo_proxy_resolver_factory_.CreateFactoryRemote())); test_mojo_proxy_resolver_factory_.CreateFactoryRemote()));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
builder_.SetDhcpWpadUrlClient(network::mojom::DhcpWpadUrlClientPtr( builder_.SetDhcpWpadUrlClient(mojom::DhcpWpadUrlClientPtr(
network::MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver( MockMojoDhcpWpadUrlClient::CreateWithSelfOwnedReceiver(std::string())));
std::string())));
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
std::unique_ptr<net::URLRequestContext> context(builder_.Build()); std::unique_ptr<net::URLRequestContext> context(builder_.Build());
...@@ -141,4 +139,4 @@ TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) { ...@@ -141,4 +139,4 @@ TEST_F(URLRequestContextBuilderMojoTest, ShutdownWithHungRequest) {
} // namespace } // namespace
} // namespace content } // namespace network
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