Commit f450b46c authored by Clark DuVall's avatar Clark DuVall Committed by Chromium LUCI CQ

Fix TSan flake from ContentMockCertVerifier::set_default_result

This seems to be flaky on TSan builds when set_default_result is called
from SetUpOnMainThread(). This should prevent calling it in this case.

Bug: 1159734
Change-Id: Id08167574874af6bb7aab5dd03df6622d062b7a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2618393
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841684}
parent e36c5b07
......@@ -5,6 +5,7 @@
#include "content/public/test/content_mock_cert_verifier.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/network_service_util.h"
......@@ -26,12 +27,18 @@ void ContentMockCertVerifier::CertVerifier::set_default_result(
int default_result) {
verifier_->set_default_result(default_result);
// Set the default result as a flag in case the FeatureList has not been
// initialized yet and we don't know if network service will run out of
// process.
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kMockCertVerifierDefaultResultForTesting,
base::NumberToString(default_result));
// If set_default_result is called before the FeatureList is available, add
// the command line flag since the network service may be running out of
// process. We don't want to set the command line flag otherwise since it can
// cause TSan errors.
if (base::FeatureList::GetInstance() == nullptr) {
// Set the default result as a flag in case the FeatureList has not been
// initialized yet and we don't know if network service will run out of
// process.
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kMockCertVerifierDefaultResultForTesting,
base::NumberToString(default_result));
}
if (IsInProcessNetworkService())
return;
......
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