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

Unified Diff: chrome/browser/chromeos/file_manager/file_watcher_unittest.cc

Issue 2966713002: file_manager: Migrate FILE thread to TaskScheduler (Closed)
Patch Set: fix unit test Created 3 years, 6 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 | « chrome/browser/chromeos/file_manager/file_watcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
diff --git a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
index 6ba94877551948434960fe90a328bc6d22f3e523..9ebf99cc6179dc062c21230feccee006e0acd572 100644
--- a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc
@@ -8,6 +8,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/drive/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -129,7 +130,9 @@ TEST_F(FileManagerFileWatcherTest, WatchLocalFile) {
CreateQuitCallback(
&run_loop, CreateCopyResultCallback(&changed_path, &on_change_error)),
CreateCopyResultCallback(&watcher_created));
- // Spin the message loop so the base::FilePathWatcher is created.
+ // Flush the task scheduler and spin the message loop and so the
+ // base::FilePathWatcher is created.
+ base::TaskScheduler::GetInstance()->FlushForTesting();
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(watcher_created);
@@ -144,11 +147,11 @@ TEST_F(FileManagerFileWatcherTest, WatchLocalFile) {
ASSERT_EQ(temp_dir.GetPath().value(), changed_path.value());
// This is ugly, but FileWatcher should be deleted explicitly here, and
- // spin the message loop so the base::FilePathWatcher is deleted.
+ // flush the task scheduler, so the base::FilePathWatcher is deleted.
// Otherwise, base::FilePathWatcher may detect a change when the temporary
// directory is deleted, which may result in crash.
file_watcher.reset();
- base::RunLoop().RunUntilIdle();
+ base::TaskScheduler::GetInstance()->FlushForTesting();
}
} // namespace
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698