diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 05:55:35 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 05:55:35 +0000 |
commit | 08de3cde4d95e9c962aee2386d7297d561404513 (patch) | |
tree | e651002716949f84f3a6555166e33c6e9cb7034f /base/message_loop_unittest.cc | |
parent | 166020bd7aade44caeaefd67422b6162172a8956 (diff) | |
download | chromium_src-08de3cde4d95e9c962aee2386d7297d561404513.zip chromium_src-08de3cde4d95e9c962aee2386d7297d561404513.tar.gz chromium_src-08de3cde4d95e9c962aee2386d7297d561404513.tar.bz2 |
rollback r1891
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop_unittest.cc')
-rw-r--r-- | base/message_loop_unittest.cc | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc index e79c576..b36090a6d 100644 --- a/base/message_loop_unittest.cc +++ b/base/message_loop_unittest.cc @@ -290,52 +290,6 @@ void RunTest_PostDelayedTask_InPostOrder_3(MessageLoop::Type message_loop_type) EXPECT_TRUE(run_time2 > run_time1); } -class RecordDeletionTask : public Task { - public: - RecordDeletionTask(Task* post_on_delete, bool* was_deleted) - : post_on_delete_(post_on_delete), was_deleted_(was_deleted) { - } - ~RecordDeletionTask() { - *was_deleted_ = true; - if (post_on_delete_) - MessageLoop::current()->PostTask(FROM_HERE, post_on_delete_); - } - virtual void Run() {} - private: - Task* post_on_delete_; - bool* was_deleted_; -}; - -void RunTest_EnsureTaskDeletion(MessageLoop::Type message_loop_type) { - bool a_was_deleted = false; - bool b_was_deleted = false; - { - MessageLoop loop(message_loop_type); - loop.PostTask( - FROM_HERE, new RecordDeletionTask(NULL, &a_was_deleted)); - loop.PostDelayedTask( - FROM_HERE, new RecordDeletionTask(NULL, &b_was_deleted), 1000); - } - EXPECT_TRUE(a_was_deleted); - EXPECT_TRUE(b_was_deleted); -} - -void RunTest_EnsureTaskDeletion_Chain(MessageLoop::Type message_loop_type) { - bool a_was_deleted = false; - bool b_was_deleted = false; - bool c_was_deleted = false; - { - MessageLoop loop(message_loop_type); - RecordDeletionTask* a = new RecordDeletionTask(NULL, &a_was_deleted); - RecordDeletionTask* b = new RecordDeletionTask(a, &b_was_deleted); - RecordDeletionTask* c = new RecordDeletionTask(b, &c_was_deleted); - loop.PostTask(FROM_HERE, c); - } - EXPECT_TRUE(a_was_deleted); - EXPECT_TRUE(b_was_deleted); - EXPECT_TRUE(c_was_deleted); -} - class NestingTest : public Task { public: explicit NestingTest(int* depth) : depth_(depth) { @@ -1095,18 +1049,6 @@ TEST(MessageLoopTest, PostDelayedTask_InPostOrder_3) { RunTest_PostDelayedTask_InPostOrder_3(MessageLoop::TYPE_IO); } -TEST(MessageLoopTest, EnsureTaskDeletion) { - RunTest_EnsureTaskDeletion(MessageLoop::TYPE_DEFAULT); - RunTest_EnsureTaskDeletion(MessageLoop::TYPE_UI); - RunTest_EnsureTaskDeletion(MessageLoop::TYPE_IO); -} - -TEST(MessageLoopTest, EnsureTaskDeletion_Chain) { - RunTest_EnsureTaskDeletion_Chain(MessageLoop::TYPE_DEFAULT); - RunTest_EnsureTaskDeletion_Chain(MessageLoop::TYPE_UI); - RunTest_EnsureTaskDeletion_Chain(MessageLoop::TYPE_IO); -} - #if defined(OS_WIN) TEST(MessageLoopTest, Crasher) { RunTest_Crasher(MessageLoop::TYPE_DEFAULT); |