Commit 5a4b7822 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Fix file leaks in MediaEngagementServiceTest.CleanUpDatabaseWhenHistoryIsExpired.

During service teardown, tasks are posted to the TestMockTimeTaskRunner
to close open files. These must be run during TearDown so that files can
be closed, thereby allowing the ScopedTempDir to clean itself.

Bug: 546640
Change-Id: Ibdfa0cc63f79f27237040765777fed344f7ad7b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895337
Auto-Submit: Greg Thompson <grt@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711836}
parent 56d636c2
......@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
......@@ -176,6 +177,11 @@ class MediaEngagementServiceTest : public ChromeRenderViewHostTestHarness,
void TearDown() override {
service_->Shutdown();
ChromeRenderViewHostTestHarness::TearDown();
// Tests that run a history service that uses the mock task runner for
// backend processing will post tasks there during TearDown. Run them now to
// avoid leaks.
mock_time_task_runner_->RunUntilIdle();
service_.reset();
}
......
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