diff options
-rw-r--r-- | base/lazy_instance.cc | 11 | ||||
-rw-r--r-- | base/lazy_instance.h | 4 | ||||
-rw-r--r-- | base/test/run_all_unittests.cc | 4 | ||||
-rw-r--r-- | base/test/test_suite.h | 26 | ||||
-rw-r--r-- | net/base/run_all_unittests.cc | 1 |
5 files changed, 1 insertions, 45 deletions
diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc index f98ba3f..957482c 100644 --- a/base/lazy_instance.cc +++ b/base/lazy_instance.cc @@ -36,19 +36,8 @@ void LazyInstanceHelper::CompleteInstance(void* instance, void (*dtor)(void*)) { // Instance is created, go from CREATING to CREATED. base::subtle::Release_Store(&state_, STATE_CREATED); - // Allow reusing the LazyInstance (reset it to the initial state). This - // makes possible calling all AtExit callbacks between tests. Assumes that - // no other threads execute when AtExit callbacks are processed. - base::AtExitManager::RegisterCallback(&LazyInstanceHelper::ResetState, - this); - // Make sure that the lazily instantiated object will get destroyed at exit. base::AtExitManager::RegisterCallback(dtor, instance); } -// static -void LazyInstanceHelper::ResetState(void* helper) { - reinterpret_cast<LazyInstanceHelper*>(helper)->state_ = STATE_EMPTY; -} - } // namespace base diff --git a/base/lazy_instance.h b/base/lazy_instance.h index 57f8aeb5..52a5124 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -81,10 +81,6 @@ class LazyInstanceHelper { base::subtle::Atomic32 state_; private: - // Resets state of |helper| to STATE_EMPTY so that it can be reused. - // Not thread safe. - static void ResetState(void* helper); - DISALLOW_COPY_AND_ASSIGN(LazyInstanceHelper); }; diff --git a/base/test/run_all_unittests.cc b/base/test/run_all_unittests.cc index 7b90358..841b353 100644 --- a/base/test/run_all_unittests.cc +++ b/base/test/run_all_unittests.cc @@ -5,7 +5,5 @@ #include "base/test/test_suite.h" int main(int argc, char** argv) { - TestSuite test_suite(argc, argv); - test_suite.EnforceTestIsolation(); - return test_suite.Run(); + return TestSuite(argc, argv).Run(); } diff --git a/base/test/test_suite.h b/base/test/test_suite.h index 3cfc7ec..c0a2891 100644 --- a/base/test/test_suite.h +++ b/base/test/test_suite.h @@ -37,25 +37,6 @@ const char kStrictFailureHandling[] = "strict_failure_handling"; // Match function used by the GetTestCount method. typedef bool (*TestMatch)(const testing::TestInfo&); -// By setting up a shadow AtExitManager, this test event listener ensures that -// no state is carried between tests (like singletons, lazy instances, etc). -// Of course it won't help if the code under test corrupts memory. -class TestIsolationEnforcer : public testing::EmptyTestEventListener { - public: - virtual void OnTestStart(const testing::TestInfo& test_info) { - ASSERT_FALSE(exit_manager_.get()); - exit_manager_.reset(new base::ShadowingAtExitManager()); - } - - virtual void OnTestEnd(const testing::TestInfo& test_info) { - ASSERT_TRUE(exit_manager_.get()); - exit_manager_.reset(); - } - - private: - scoped_ptr<base::ShadowingAtExitManager> exit_manager_; -}; - class TestSuite { public: TestSuite(int argc, char** argv); @@ -111,13 +92,6 @@ class TestSuite { return count; } - // TODO(phajdan.jr): Enforce isolation for all tests once it's stable. - void EnforceTestIsolation() { - testing::TestEventListeners& listeners = - testing::UnitTest::GetInstance()->listeners(); - listeners.Append(new TestIsolationEnforcer); - } - void CatchMaybeTests() { testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc index 85bda7d..cd11350 100644 --- a/net/base/run_all_unittests.cc +++ b/net/base/run_all_unittests.cc @@ -23,6 +23,5 @@ int main(int argc, char** argv) { base::EnsureNSPRInit(); #endif - // TODO(phajdan.jr): Enforce test isolation, http://crbug.com/12710. return test_suite.Run(); } |