Index: chrome/browser/metrics/chrome_metrics_service_accessor.cc |
diff --git a/chrome/browser/metrics/chrome_metrics_service_accessor.cc b/chrome/browser/metrics/chrome_metrics_service_accessor.cc |
index cd8e07148a694059c084a6a839aba95713955490..191425ae0a6f26f94653585a7011d91612c57d80 100644 |
--- a/chrome/browser/metrics/chrome_metrics_service_accessor.cc |
+++ b/chrome/browser/metrics/chrome_metrics_service_accessor.cc |
@@ -15,8 +15,26 @@ |
#include "chrome/browser/chromeos/settings/cros_settings.h" |
#endif |
+namespace { |
+ |
+const bool* gMetricsAndCrashReportingForTesting = nullptr; |
Alexei Svitkine (slow)
2016/09/02 18:05:45
Nit: Incorrect naming convention.
We only use kFo
Nathan Parker
2016/09/02 22:42:36
Done.
|
+ |
+} // namespace |
+ |
+// static |
+void ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting( |
+ const bool* value) { |
+ DCHECK_NE(gMetricsAndCrashReportingForTesting == nullptr, value == nullptr) |
+ << "Unpaired set/reset"; |
+ |
+ gMetricsAndCrashReportingForTesting = value; |
+} |
+ |
// static |
bool ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled() { |
+ if (gMetricsAndCrashReportingForTesting) |
+ return *gMetricsAndCrashReportingForTesting; |
+ |
// TODO(blundell): Fix the unittests that don't set up the UI thread and |
// change this to just be DCHECK_CURRENTLY_ON(). |
DCHECK( |