diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-26 11:13:32 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-26 11:13:32 +0000 |
commit | 430d228cb2ba215820bcbb021986d78149e46524 (patch) | |
tree | eb6eaee187235ff6d51d2ac3c6290a6a40614696 /net | |
parent | 77c233acb9c187116f739ca0d177088f1c921176 (diff) | |
download | chromium_src-430d228cb2ba215820bcbb021986d78149e46524.zip chromium_src-430d228cb2ba215820bcbb021986d78149e46524.tar.gz chromium_src-430d228cb2ba215820bcbb021986d78149e46524.tar.bz2 |
Apply test isolation goodness to net_unittests.
We're going to have it enabled for all tests, but I'm enabling
it one-by-one to limit damage from possible problems.
TEST=none
BUG=12710
Review URL: http://codereview.chromium.org/439007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/host_resolver_proc.cc | 16 | ||||
-rw-r--r-- | net/base/run_all_unittests.cc | 4 | ||||
-rw-r--r-- | net/ocsp/nss_ocsp.cc | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc index cd6fc12..473a70c3 100644 --- a/net/base/host_resolver_proc.cc +++ b/net/base/host_resolver_proc.cc @@ -77,12 +77,6 @@ int HostResolverProc::ResolveUsingPrevious(const std::string& host, // Keep a timer per calling thread to rate limit the calling of res_ninit. class DnsReloadTimer { public: - DnsReloadTimer() { - tls_index_.Initialize(SlotReturnFunction); - } - - ~DnsReloadTimer() { } - // Check if the timer for the calling thread has expired. When no // timer exists for the calling thread, create one. bool Expired() { @@ -112,6 +106,16 @@ class DnsReloadTimer { } private: + friend struct DefaultSingletonTraits<DnsReloadTimer>; + + DnsReloadTimer() { + tls_index_.Initialize(SlotReturnFunction); + } + + ~DnsReloadTimer() { + tls_index_.Free(); + } + // We use thread local storage to identify which base::TimeTicks to // interact with. static ThreadLocalStorage::Slot tls_index_ ; diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc index 2bed0b7..178bd5b 100644 --- a/net/base/run_all_unittests.cc +++ b/net/base/run_all_unittests.cc @@ -30,5 +30,7 @@ #include "net/base/net_test_suite.h" int main(int argc, char** argv) { - return NetTestSuite(argc, argv).Run(); + NetTestSuite test_suite(argc, argv); + test_suite.EnforceTestIsolation(); + return test_suite.Run(); } diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index 85fc5f5..7760e6b 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -61,6 +61,8 @@ class OCSPInitSingleton : public MessageLoop::DestructionObserver { friend struct DefaultSingletonTraits<OCSPInitSingleton>; OCSPInitSingleton(); virtual ~OCSPInitSingleton() { + if (io_loop_) + io_loop_->RemoveDestructionObserver(this); request_context_ = NULL; } |