Chromium Code Reviews| Index: chrome/browser/ssl/cert_report_helper.cc |
| diff --git a/chrome/browser/ssl/cert_report_helper.cc b/chrome/browser/ssl/cert_report_helper.cc |
| index 053ce92196d6b6c9f2173c934a0c723e0e64c812..418750ad5280fa60daf4e4ca6e547cb53d4aa4b4 100644 |
| --- a/chrome/browser/ssl/cert_report_helper.cc |
| +++ b/chrome/browser/ssl/cert_report_helper.cc |
| @@ -29,6 +29,10 @@ |
| namespace { |
| +// Certificate reports are only sent from official builds, but this flag can be |
| +// set by tests. |
| +static bool g_is_fake_official_build_for_testing = false; |
| + |
| // Returns a pointer to the Profile associated with |web_contents|. |
| Profile* GetProfile(content::WebContents* web_contents) { |
| return Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| @@ -65,6 +69,11 @@ CertReportHelper::CertReportHelper( |
| CertReportHelper::~CertReportHelper() { |
| } |
| +// static |
| +void CertReportHelper::SetFakeOfficialBuildForTesting() { |
| + g_is_fake_official_build_for_testing = true; |
| +} |
| + |
| void CertReportHelper::PopulateExtendedReportingOption( |
| base::DictionaryValue* load_time_data) { |
| // Only show the checkbox if not off-the-record and if this client is |
| @@ -149,6 +158,15 @@ bool CertReportHelper::ShouldShowCertificateReporterCheckbox() { |
| bool CertReportHelper::ShouldReportCertificateError() { |
| DCHECK(ShouldShowCertificateReporterCheckbox()); |
| + |
| + bool is_official_build = g_is_fake_official_build_for_testing; |
|
Nathan Parker
2017/05/26 21:34:07
I feel like there could be a better pattern than t
|
| +#if defined(OFFICIAL_BUILD) && defined(GOOGLE_CHROME_BUILD) |
| + is_official_build = true; |
| +#endif |
| + |
| + if (!is_official_build) |
| + return false; |
| + |
| // Even in case the checkbox was shown, we don't send error reports |
| // for all of these users. Check the Finch configuration for a sending |
| // threshold and only send reports in case the threshold isn't exceeded. |