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

Unified Diff: chrome/browser/sync/test/integration/bookmarks_helper.cc

Issue 2402553005: Do not run a nested loop in content::DeferredQuitRunLoop. (Closed)
Patch Set: fix OneClickSigninDialogViewTest Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/bookmarks_helper.cc
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc
index b9a21d7d0c9d257cc66511d589d02ed1cb680dbc..5efc285b9d7a8ca3deff9df88971f8b31d5d72e8 100644
--- a/chrome/browser/sync/test/integration/bookmarks_helper.cc
+++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -14,6 +14,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
@@ -56,15 +57,13 @@ using bookmarks::BookmarkNode;
namespace {
-// History task which runs all pending tasks on the history thread and
-// signals when the tasks have completed.
-class HistoryEmptyTask : public history::HistoryDBTask {
+// History task which signals an event.
+class SignalEventTask : public history::HistoryDBTask {
public:
- explicit HistoryEmptyTask(base::WaitableEvent* done) : done_(done) {}
+ explicit SignalEventTask(base::WaitableEvent* done) : done_(done) {}
bool RunOnDBThread(history::HistoryBackend* backend,
history::HistoryDatabase* db) override {
- content::RunAllPendingInMessageLoop();
done_->Signal();
return true;
}
@@ -313,9 +312,10 @@ void WaitForHistoryToProcessPendingTasks() {
base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
base::CancelableTaskTracker task_tracker;
- history_service->ScheduleDBTask(
- std::unique_ptr<history::HistoryDBTask>(new HistoryEmptyTask(&done)),
- &task_tracker);
+ // Post a task that signals |done|. Since tasks run in posting order, all
+ // previously posted tasks have run when |done| is signaled.
+ history_service->ScheduleDBTask(base::MakeUnique<SignalEventTask>(&done),
+ &task_tracker);
done.Wait();
}
// Wait such that any notifications broadcast from one of the history threads
« no previous file with comments | « no previous file | chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698