Commit e25d77f7 authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Add process cleanup logic to EventListenerMapTest.

This change simply cleans up the process that is created in SetUp().
Despite what the comment in SetUp() said, these process objects were not
actually being cleaned up during BrowserContext shutdown. As a result
these process objects stay alive between tests in a process global map
managed by GetAllHosts() in render_process_host_imp.cc. While this
doesn't cause any specific problems in the current tests, there is
potential for flakiness because state is being maintained across test
cases. It also exposes pointers to destroyed BrowserContexts via
GetAllHosts() and can enable unexpected matches to old process objects
if a previous BrowserContext pointer gets reused in a subsequent test.
Explicitly cleaning up the process during TearDown() avoids these issues.

Change-Id: Idf879b9f48bc31cfcda20c89925ea2d5f8ff1714
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151337Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759426}
parent baa615d5
......@@ -50,10 +50,16 @@ class EventListenerMapTest : public ExtensionsTest {
void SetUp() override {
ExtensionsTest::SetUp();
// |process_| will be destroyed by |browser_context()| when it goes away.
process_ = new content::MockRenderProcessHost(browser_context());
}
void TearDown() override {
process_->Cleanup();
process_ = nullptr;
ExtensionsTest::TearDown();
}
std::unique_ptr<DictionaryValue> CreateHostSuffixFilter(
const std::string& suffix) {
auto filter_dict = std::make_unique<DictionaryValue>();
......
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