diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-02 15:34:06 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-02 15:34:06 +0000 |
commit | 6e022a5f0a75f716c23db51c7a2e60cb6969ad37 (patch) | |
tree | cfc8c3d9fe944a8528887e482d7c81ec1982f3bf /base/timer_unittest.cc | |
parent | a1a2e8ea06bdd7220d57fa7d193787374c0f296e (diff) | |
download | chromium_src-6e022a5f0a75f716c23db51c7a2e60cb6969ad37.zip chromium_src-6e022a5f0a75f716c23db51c7a2e60cb6969ad37.tar.gz chromium_src-6e022a5f0a75f716c23db51c7a2e60cb6969ad37.tar.bz2 |
Reland 6190 now that the tree is green to see if
it's still breaking the tests
Review URL: http://codereview.chromium.org/12868
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/timer_unittest.cc')
-rw-r--r-- | base/timer_unittest.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc index face9c8..1fb44a3 100644 --- a/base/timer_unittest.cc +++ b/base/timer_unittest.cc @@ -145,3 +145,24 @@ TEST(TimerTest, RepeatingTimer_Cancel) { RunTest_RepeatingTimer_Cancel(MessageLoop::TYPE_UI); RunTest_RepeatingTimer_Cancel(MessageLoop::TYPE_IO); } + +TEST(TimerTest, MessageLoopShutdown) { + // This test is designed to verify that shutdown of the + // message loop does not cause crashes if there were pending + // timers not yet fired. It may only trigger exceptions + // if debug heap checking (or purify) is enabled. + bool did_run = false; + { + OneShotTimerTester a(&did_run); + OneShotTimerTester b(&did_run); + OneShotTimerTester c(&did_run); + OneShotTimerTester d(&did_run); + { + MessageLoop loop(MessageLoop::TYPE_DEFAULT); + a.Start(); + b.Start(); + } // MessageLoop destructs by falling out of scope. + } // OneShotTimers destruct. SHOULD NOT CRASH, of course. + + EXPECT_EQ(false, did_run); +} |