diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 03:17:23 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 03:17:23 +0000 |
commit | d47d090d36b76c50eb80e035a426a4d8e59a2b5a (patch) | |
tree | d212532d69b70c197327198adc1fabb62aab0393 /remoting/protocol | |
parent | 5cffc739a121a55ade333e4a504eeb8f9c78aacf (diff) | |
download | chromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.zip chromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.tar.gz chromium_src-d47d090d36b76c50eb80e035a426a4d8e59a2b5a.tar.bz2 |
Fixed memory leaks in remoting_unittests.
BUG=70826
TEST=remoting_unittests under valgrind
Review URL: http://codereview.chromium.org/6266020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r-- | remoting/protocol/message_reader_unittest.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc index 5f17a1a..3237cb5 100644 --- a/remoting/protocol/message_reader_unittest.cc +++ b/remoting/protocol/message_reader_unittest.cc @@ -59,6 +59,11 @@ class MessageReaderTest : public testing::Test { return result == expected; } + void RunAndDeleteTask(Task* task) { + task->Run(); + delete task; + } + // MessageLoop must be first here, so that is is destroyed the last. MessageLoop message_loop_; @@ -90,7 +95,7 @@ TEST_F(MessageReaderTest, OneMessage_Delay) { // finished processing the previous message. EXPECT_FALSE(socket_.read_pending()); - done_task->Run(); + RunAndDeleteTask(done_task); EXPECT_TRUE(socket_.read_pending()); } @@ -137,11 +142,11 @@ TEST_F(MessageReaderTest, TwoMessages_Together) { // finished processing the previous message. EXPECT_FALSE(socket_.read_pending()); - done_task1->Run(); + RunAndDeleteTask(done_task1); EXPECT_FALSE(socket_.read_pending()); - done_task2->Run(); + RunAndDeleteTask(done_task2); EXPECT_TRUE(socket_.read_pending()); } @@ -172,7 +177,7 @@ TEST_F(MessageReaderTest, TwoMessages_Instant) { // finished processing the second message. EXPECT_FALSE(socket_.read_pending()); - done_task2->Run(); + RunAndDeleteTask(done_task2); EXPECT_TRUE(socket_.read_pending()); } @@ -216,7 +221,7 @@ TEST_F(MessageReaderTest, TwoMessages_Separately) { // finished processing the previous message. EXPECT_FALSE(socket_.read_pending()); - done_task->Run(); + RunAndDeleteTask(done_task); EXPECT_TRUE(socket_.read_pending()); @@ -233,7 +238,7 @@ TEST_F(MessageReaderTest, TwoMessages_Separately) { // finished processing the previous message. EXPECT_FALSE(socket_.read_pending()); - done_task->Run(); + RunAndDeleteTask(done_task); EXPECT_TRUE(socket_.read_pending()); } |