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 6e52ba5ce291d2880fe88a19cb88d8056c39e35a..f6e22bdf79472f7081810c1d01c703ff3c266d35 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" |
@@ -701,29 +701,25 @@ 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))); |
+ base::Bind(&CreateFileForTestingOnIOThread, base::Unretained(context), |
+ path, temp_file, base::Unretained(&result), |
+ 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( |
@@ -731,13 +727,11 @@ 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))); |
+ base::Bind(&CopyInCompletion, base::Unretained(result), quit_closure)); |
} |
}; |