Commit a83d3198 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

Re-enable FileManagerFileWatcherTest/WatchLocalFile all bots

Use the TestBrowserThreadBundle RunUntilIdle to flush all tasks at the
end of the test, rather than base::Runloop::RunUntilIdle, which caused
flakes on the MSAN/ASAN bots.

Test: unit_tests --gtest_filter=FileManagerFileWatcher*WatchLocalFile
Bug: 813483
Change-Id: I867e5d914074e6c9d389a5f932836cd6cd8a627c
Reviewed-on: https://chromium-review.googlesource.com/1113399Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570264}
parent b83f3328
......@@ -26,6 +26,8 @@ class FileManagerFileWatcherTest : public testing::Test {
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
}
void FlushMessageLoopTasks() { thread_bundle_.RunUntilIdle(); };
private:
content::TestBrowserThreadBundle thread_bundle_;
};
......@@ -106,8 +108,7 @@ TEST_F(FileManagerFileWatcherTest, AddSameExtensionMultipleTimes) {
ASSERT_EQ(0U, extension_ids.size());
}
// Disabled for flakiness. crbug.com/813483.
TEST_F(FileManagerFileWatcherTest, DISABLED_WatchLocalFile) {
TEST_F(FileManagerFileWatcherTest, WatchLocalFile) {
const base::FilePath kVirtualPath =
base::FilePath::FromUTF8Unsafe("foo/bar.txt");
const char kExtensionId[] = "extension-id";
......@@ -140,13 +141,14 @@ TEST_F(FileManagerFileWatcherTest, DISABLED_WatchLocalFile) {
// Create a temporary file in the temporary directory. The file watcher
// should detect the change in the directory.
base::FilePath temp_file_path;
base::FilePath temporary_file;
ASSERT_TRUE(
base::CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_path));
// Wait until the directory change is notified, and also flush the tasks in
// the message loop since |change_callback| can be called multiple times.
base::CreateTemporaryFileInDir(temp_dir.GetPath(), &temporary_file));
// Wait until the directory change is notified. Also flush tasks in the
// message loop since |change_callback| can be called multiple times.
change_run_loop.Run();
base::RunLoop().RunUntilIdle();
FlushMessageLoopTasks();
ASSERT_FALSE(on_change_error);
ASSERT_EQ(temp_dir.GetPath().value(), changed_path.value());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment