Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: chrome/browser/metrics/chrome_metrics_service_accessor.cc

Issue 2302823003: Only report PasswordState in Sync for UMA+non-custom passphrase users. (Closed)
Patch Set: Split apart state-transition test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ceb626cc5aac5a01d1be9b2b569719d7914840e8 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* g_metrics_consent_for_testing = nullptr;
+
+} // namespace
+
+// static
+void ChromeMetricsServiceAccessor::SetMetricsAndCrashReportingForTesting(
+ const bool* value) {
+ DCHECK_NE(g_metrics_consent_for_testing == nullptr, value == nullptr)
+ << "Unpaired set/reset";
+
+ g_metrics_consent_for_testing = value;
+}
+
// static
bool ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled() {
+ if (g_metrics_consent_for_testing)
+ return *g_metrics_consent_for_testing;
+
// TODO(blundell): Fix the unittests that don't set up the UI thread and
// change this to just be DCHECK_CURRENTLY_ON().
DCHECK(

Powered by Google App Engine
This is Rietveld 408576698