PKGBUILDs/extra/chromium/0009-Clear-the-testing-provider-on-shutdown.patch
2018-03-16 00:03:44 +00:00

36 lines
1.5 KiB
Diff

From 45e550e306307b21d697bae00ea4e8dd7e22f0ed Mon Sep 17 00:00:00 2001
From: Andrew Wilson <atwilson@chromium.org>
Date: Tue, 30 Jan 2018 14:47:47 +0000
Subject: [PATCH 09/10] Clear the testing provider on shutdown.
Restore code to clean up the test instance of the PolicyProvider, so unit tests
that set the PolicyProvider no longer crash when run in succession.
Bug: None
Test: Run unit_tests --gtest_filter=ProfilePolicyConnectorTest*
Change-Id: I3a90fb04f3736c7e1351791b52886d726913aeed
Reviewed-on: https://chromium-review.googlesource.com/893098
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Drew Wilson <atwilson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532865}
---
components/policy/core/browser/browser_policy_connector_base.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/components/policy/core/browser/browser_policy_connector_base.cc b/components/policy/core/browser/browser_policy_connector_base.cc
index 35ce7605063d..cc9625f4f8af 100644
--- a/components/policy/core/browser/browser_policy_connector_base.cc
+++ b/components/policy/core/browser/browser_policy_connector_base.cc
@@ -60,6 +60,9 @@ void BrowserPolicyConnectorBase::Shutdown() {
for (const auto& provider : *policy_providers_)
provider->Shutdown();
}
+ // Drop g_testing_provider so that tests executed with --single_process can
+ // call SetPolicyProviderForTesting() again. It is still owned by the test.
+ g_testing_provider = nullptr;
g_created_policy_service = false;
}
--
2.16.2