diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-26 15:10:50 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-26 15:10:50 +0000 |
commit | bae459ccb13e6107ab387e919d51b557b7004cc0 (patch) | |
tree | 713dad977f06283c455c2d6a5738ca10a71bf7a3 /webkit | |
parent | ba27aefa1ab3f9821355e5e5836a907e4c4ca415 (diff) | |
download | chromium_src-bae459ccb13e6107ab387e919d51b557b7004cc0.zip chromium_src-bae459ccb13e6107ab387e919d51b557b7004cc0.tar.gz chromium_src-bae459ccb13e6107ab387e919d51b557b7004cc0.tar.bz2 |
2nd try: Wiring up sync methods in SyncFileSystemService
Original review: https://chromiumcodereview.appspot.com/11418085/
Change from the original review: diff from patch 1 to patch 2
(Added empty tasks to wait for remaining shutdown tasks to finish before we terminate the test)
BUG=155505
TEST=SyncFileSystemServiceTest.Simple{Local,Remote}SyncFlow
TBR=tzik
Review URL: https://codereview.chromium.org/11418152
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/syncable/canned_syncable_file_system.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.cc b/webkit/fileapi/syncable/canned_syncable_file_system.cc index 81dac66..05448f3 100644 --- a/webkit/fileapi/syncable/canned_syncable_file_system.cc +++ b/webkit/fileapi/syncable/canned_syncable_file_system.cc @@ -8,6 +8,7 @@ #include "base/bind_helpers.h" #include "base/file_util.h" #include "base/message_loop_proxy.h" +#include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -158,6 +159,13 @@ void DidGetUsageAndQuota(const quota::StatusCallback& callback, callback.Run(status); } +void EnsureLastTaskRuns(base::SingleThreadTaskRunner* runner) { + base::RunLoop run_loop; + runner->PostTaskAndReply( + FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure()); + run_loop.Run(); +} + } // namespace CannedSyncableFileSystem::CannedSyncableFileSystem( @@ -214,9 +222,9 @@ void CannedSyncableFileSystem::TearDown() { quota_manager_ = NULL; file_system_context_ = NULL; - io_task_runner_->PostTaskAndReply( - FROM_HERE, base::Bind(&base::DoNothing), base::Bind(&Quit)); - MessageLoop::current()->Run(); + // Make sure we give some more time to finish tasks on other threads. + EnsureLastTaskRuns(io_task_runner_); + EnsureLastTaskRuns(file_task_runner_); } FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { |