diff options
author | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:03:08 +0000 |
---|---|---|
committer | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:03:08 +0000 |
commit | aed0ae17565a5af8b534ea3ec6a587725d028720 (patch) | |
tree | f0886521fd00c484b768b2340fba475155a75d13 /net/http | |
parent | 8dc1bfe262b87f61e9bc611caedb22a794f85254 (diff) | |
download | chromium_src-aed0ae17565a5af8b534ea3ec6a587725d028720.zip chromium_src-aed0ae17565a5af8b534ea3ec6a587725d028720.tar.gz chromium_src-aed0ae17565a5af8b534ea3ec6a587725d028720.tar.bz2 |
Reset static HttpStreamFactory settings before each test in a NetTestSuite.
This improves test isolation.
BUG=
TEST=./net_unittests --gtest_shuffle=1 --gtest_random_seed=56044
More specifically:
TEST=./net_unittests --gtest_shuffle=1 --gtest_random_seed=56044 --gtest_filter=Spdy/SpdyNetworkTransactionTest.ThreeGets/1:HttpStreamFactoryTest.PreconnectHttpProxy
Review URL: http://codereview.chromium.org/8295009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_stream_factory.cc | 19 | ||||
-rw-r--r-- | net/http/http_stream_factory.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index bcbd8d3..70a4940 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc @@ -14,6 +14,9 @@ namespace net { +// WARNING: If you modify or add any static flags, you must keep them in sync +// with |ResetStaticSettingsToInit|. This is critical for unit test isolation. + // static const HostMappingRules* HttpStreamFactory::host_mapping_rules_ = NULL; // static @@ -33,6 +36,22 @@ bool HttpStreamFactory::ignore_certificate_errors_ = false; HttpStreamFactory::~HttpStreamFactory() {} +// static +void HttpStreamFactory::ResetStaticSettingsToInit() { + // WARNING: These must match the initializers above. + delete host_mapping_rules_; + delete next_protos_; + delete forced_spdy_exclusions_; + host_mapping_rules_ = NULL; + next_protos_ = NULL; + spdy_enabled_ = true; + use_alternate_protocols_ = false; + force_spdy_over_ssl_ = true; + force_spdy_always_ = false; + forced_spdy_exclusions_ = NULL; + ignore_certificate_errors_ = false; +} + void HttpStreamFactory::ProcessAlternateProtocol( HttpServerProperties* http_server_properties, const std::string& alternate_protocol_str, diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h index f92c11e..3cbad96 100644 --- a/net/http/http_stream_factory.h +++ b/net/http/http_stream_factory.h @@ -176,6 +176,10 @@ class NET_EXPORT HttpStreamFactory { virtual bool IsTLSIntolerantServer(const HostPortPair& server) const = 0; // Static settings + + // Reset all static settings to initialized values. Used to init test suite. + static void ResetStaticSettingsToInit(); + static GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); // Turns spdy on or off. |