Index: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc |
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc |
index a8a9eca778bc7557fd472d364cbfbdb39a68cf5b..83f4a0aabc158e7de7a0e2e7754fb2b625ff9476 100644 |
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc |
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc |
@@ -17,8 +17,8 @@ |
#include "base/macros.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
#include "base/strings/stringprintf.h" |
-#include "base/synchronization/waitable_event.h" |
#include "build/build_config.h" |
#include "chrome/browser/download/download_file_icon_extractor.h" |
#include "chrome/browser/download/download_service.h" |
@@ -703,29 +703,28 @@ class HTML5FileWriter { |
} |
// Invoke the fileapi to copy it into the sandboxed filesystem. |
bool result = false; |
- base::WaitableEvent done_event( |
- base::WaitableEvent::ResetPolicy::MANUAL, |
- base::WaitableEvent::InitialState::NOT_SIGNALED); |
+ base::RunLoop run_loop; |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
base::Bind(&CreateFileForTestingOnIOThread, |
base::Unretained(context), |
path, temp_file, |
base::Unretained(&result), |
- base::Unretained(&done_event))); |
+ run_loop.QuitClosure())); |
// Wait for that to finish. |
- done_event.Wait(); |
+ run_loop.Run(); |
base::DeleteFile(temp_file, false); |
return result; |
} |
private: |
static void CopyInCompletion(bool* result, |
- base::WaitableEvent* done_event, |
+ const base::Closure& quit_closure, |
base::File::Error error) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
*result = error == base::File::FILE_OK; |
- done_event->Signal(); |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, FROM_HERE, quit_closure); |
} |
static void CreateFileForTestingOnIOThread( |
@@ -733,13 +732,13 @@ class HTML5FileWriter { |
const storage::FileSystemURL& path, |
const base::FilePath& temp_file, |
bool* result, |
- base::WaitableEvent* done_event) { |
+ const base::Closure& quit_closure) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
context->operation_runner()->CopyInForeignFile( |
temp_file, path, |
base::Bind(&CopyInCompletion, |
base::Unretained(result), |
- base::Unretained(done_event))); |
+ quit_closure)); |
} |
}; |