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

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 3 years, 10 months 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 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));
}
};

Powered by Google App Engine
This is Rietveld 408576698