diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 13:50:50 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 13:50:50 +0000 |
commit | b7b8f66bba2c9f8253096a92376dfd047b7d0822 (patch) | |
tree | 2aff43551468591fd99e008f5a15342768430859 /base/at_exit_unittest.cc | |
parent | e9f17ab968e051627b02b6e02305417d5aee6f37 (diff) | |
download | chromium_src-b7b8f66bba2c9f8253096a92376dfd047b7d0822.zip chromium_src-b7b8f66bba2c9f8253096a92376dfd047b7d0822.tar.gz chromium_src-b7b8f66bba2c9f8253096a92376dfd047b7d0822.tar.bz2 |
Fix the flaky atexit test by preventing it from running the global atexit callbacks.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/at_exit_unittest.cc')
-rw-r--r-- | base/at_exit_unittest.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/base/at_exit_unittest.cc b/base/at_exit_unittest.cc index 692ce66..564aabc 100644 --- a/base/at_exit_unittest.cc +++ b/base/at_exit_unittest.cc @@ -33,6 +33,13 @@ namespace { +// Don't test the global AtExitManager, because asking it to process its +// AtExit callbacks can ruin the global state that other tests may depend on. +class ShadowingAtExitManager : public base::AtExitManager { + public: + ShadowingAtExitManager() : AtExitManager(true) {} +}; + int g_test_counter_1 = 0; int g_test_counter_2 = 0; @@ -56,6 +63,8 @@ void ExpectCounter1IsZero() { } // namespace TEST(AtExitTest, Basic) { + ShadowingAtExitManager shadowing_at_exit_manager; + ZeroTestCounters(); base::AtExitManager::RegisterCallback(&IncrementTestCounter1); base::AtExitManager::RegisterCallback(&IncrementTestCounter2); @@ -69,6 +78,8 @@ TEST(AtExitTest, Basic) { } TEST(AtExitTest, LIFOOrder) { + ShadowingAtExitManager shadowing_at_exit_manager; + ZeroTestCounters(); base::AtExitManager::RegisterCallback(&IncrementTestCounter1); base::AtExitManager::RegisterCallback(&ExpectCounter1IsZero); |