Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1555)

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
}
};

Powered by Google App Engine
This is Rietveld 408576698