diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 18:34:35 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 18:34:35 +0000 |
commit | 2d3baf01ef4f8ec59e7be0e253158dfdb2a98a35 (patch) | |
tree | 47b26732ab7c34a6fd961690ee3a755e33c877f9 | |
parent | e16d397e25dd8a0a3f07e81528c1f9619051cf19 (diff) | |
download | chromium_src-2d3baf01ef4f8ec59e7be0e253158dfdb2a98a35.zip chromium_src-2d3baf01ef4f8ec59e7be0e253158dfdb2a98a35.tar.gz chromium_src-2d3baf01ef4f8ec59e7be0e253158dfdb2a98a35.tar.bz2 |
Apply minor tweaks to ScopedHostMapper per review feedback.
R=wtc
Review URL: http://codereview.chromium.org/4253
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2557 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/run_all_unittests.cc | 2 | ||||
-rw-r--r-- | net/base/scoped_host_mapper.h (renamed from net/base/host_resolver_unittest.h) | 15 | ||||
-rw-r--r-- | net/base/tcp_client_socket_unittest.cc | 2 | ||||
-rw-r--r-- | net/http/http_network_layer_unittest.cc | 7 |
4 files changed, 16 insertions, 10 deletions
diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc index de79e68..71dada9 100644 --- a/net/base/run_all_unittests.cc +++ b/net/base/run_all_unittests.cc @@ -29,7 +29,7 @@ #include "base/message_loop.h" #include "base/test_suite.h" -#include "net/base/host_resolver_unittest.h" +#include "net/base/scoped_host_mapper.h" class NetTestSuite : public TestSuite { public: diff --git a/net/base/host_resolver_unittest.h b/net/base/scoped_host_mapper.h index c7ecea81..82b6c4e 100644 --- a/net/base/host_resolver_unittest.h +++ b/net/base/scoped_host_mapper.h @@ -22,14 +22,17 @@ // // scoped_host_mapper.AddRule("*.com", "127.0.0.1"); // -// If there are multiple ScopedHostMappers on the stack, then the last one +// If there are multiple ScopedHostMappers in existence, then the last one // allocated will be used. However, if it does not provide a matching rule, -// then it will delegate to the previously allocated ScopedHostMapper. +// then it will delegate to the previously set HostMapper (see SetHostMapper). // Finally, if no HostMapper matches a given hostname, then the hostname will // be unmodified. +// +// IMPORTANT: ScopedHostMapper is only designed to be used on a single thread, +// and it is a requirement that the lifetimes of multiple instances be nested. -#ifndef NET_BASE_HOST_RESOLVER_UNITTEST_H_ -#define NET_BASE_HOST_RESOLVER_UNITTEST_H_ +#ifndef NET_BASE_SCOPED_HOST_MAPPER_H_ +#define NET_BASE_SCOPED_HOST_MAPPER_H_ #ifdef UNIT_TEST @@ -41,7 +44,7 @@ namespace net { -// This class sets the HostResolverProc for a particular scope. +// This class sets the HostMapper for a particular scope. class ScopedHostMapper : public HostMapper { public: ScopedHostMapper() { @@ -83,4 +86,4 @@ class ScopedHostMapper : public HostMapper { #endif // UNIT_TEST -#endif // NET_BASE_HOST_RESOLVER_UNITTEST_H_ +#endif // NET_BASE_SCOPED_HOST_MAPPER_H_ diff --git a/net/base/tcp_client_socket_unittest.cc b/net/base/tcp_client_socket_unittest.cc index 34c0940..7dbbe45 100644 --- a/net/base/tcp_client_socket_unittest.cc +++ b/net/base/tcp_client_socket_unittest.cc @@ -5,8 +5,8 @@ #include "base/platform_test.h" #include "net/base/address_list.h" #include "net/base/host_resolver.h" -#include "net/base/host_resolver_unittest.h" #include "net/base/net_errors.h" +#include "net/base/scoped_host_mapper.h" #include "net/base/tcp_client_socket.h" #include "net/base/test_completion_callback.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index 316c91d..ec0e08c 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/base/host_resolver_unittest.h" +#include "net/base/scoped_host_mapper.h" #include "net/http/http_network_layer.h" #include "net/http/http_transaction_unittest.h" +#include "net/proxy/proxy_service.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -47,7 +48,9 @@ TEST_F(HttpNetworkLayerTest, Suspend) { } TEST_F(HttpNetworkLayerTest, GoogleGET) { - net::HttpNetworkLayer factory(NULL); + net::ProxyInfo no_proxy; // Avoid using a proxy server. + net::HttpNetworkLayer factory(&no_proxy); + TestCompletionCallback callback; net::HttpTransaction* trans = factory.CreateTransaction(); |