diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-06 16:08:52 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-06 16:08:52 +0000 |
commit | ca2f7f1069844f6274008209473c2db7fff4bbf4 (patch) | |
tree | 0c56e994ebcd2e24c80c32bc032fe6fb87dc1c92 /webkit/blob | |
parent | 075d97d34cd147da28f536c5d4e4b6bea1bfef43 (diff) | |
download | chromium_src-ca2f7f1069844f6274008209473c2db7fff4bbf4.zip chromium_src-ca2f7f1069844f6274008209473c2db7fff4bbf4.tar.gz chromium_src-ca2f7f1069844f6274008209473c2db7fff4bbf4.tar.bz2 |
LocalFileReaderTest leak fix.
BUG=123302
TEST=LocalFileReaderTest.*
Review URL: https://chromiumcodereview.appspot.com/10260002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/blob')
-rw-r--r-- | webkit/blob/local_file_reader_unittest.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/webkit/blob/local_file_reader_unittest.cc b/webkit/blob/local_file_reader_unittest.cc index 6ddf0eb..595481e 100644 --- a/webkit/blob/local_file_reader_unittest.cc +++ b/webkit/blob/local_file_reader_unittest.cc @@ -48,9 +48,8 @@ void ReadFromReader(LocalFileReader* reader, } } -void NeverCalled(int) { - ADD_FAILURE(); -} +void NeverCalled(int) { ADD_FAILURE(); } +void EmptyCallback() {} void QuitLoop() { MessageLoop::current()->Quit(); @@ -76,8 +75,7 @@ class LocalFileReaderTest : public testing::Test { virtual void TearDown() OVERRIDE { // Give another chance for deleted streams to perform Close. - MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&QuitLoop)); - MessageLoop::current()->Run(); + MessageLoop::current()->RunAllPending(); file_thread_.Stop(); } @@ -107,11 +105,16 @@ class LocalFileReaderTest : public testing::Test { FilePath test_dir() const { return dir_.path(); } FilePath test_path() const { return dir_.path().AppendASCII("test"); } - base::Time test_file_modification_time() const { return test_file_modification_time_; } + void EnsureFileTaskFinished() { + file_task_runner()->PostTaskAndReply( + FROM_HERE, base::Bind(&EmptyCallback), base::Bind(&QuitLoop)); + MessageLoop::current()->Run(); + } + private: MessageLoop message_loop_; base::Thread file_thread_; @@ -252,7 +255,7 @@ TEST_F(LocalFileReaderTest, DeleteWithUnfinishedRead) { // Delete immediately. // Should not crash; nor should NeverCalled be callback. reader.reset(); - MessageLoop::current()->RunAllPending(); + EnsureFileTaskFinished(); } } // namespace webkit_blob |