diff options
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 049a402..6e819b2 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -531,14 +531,27 @@ int BrowserMain(CommandLine &parsed_command_line, int show_command, MetricsService* metrics = NULL; if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { - if (parsed_command_line.HasSwitch(switches::kDisableMetricsReporting)) { + if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { local_state->transient()->SetBoolean(prefs::kMetricsReportingEnabled, false); } metrics = browser_process->metrics_service(); DCHECK(metrics); - // Start user experience metrics recording, if enabled. - metrics->SetRecording(local_state->GetBoolean(prefs::kMetricsIsRecording)); + + // If we're testing then we don't care what the user + // preference is, we turn on recording, but not reporting, otherwise tests + // fail. + if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { + metrics->StartRecordingOnly(); + } else { + // If the user permits metrics reporting with the checkbox in the + // prefs, we turn on recording. + bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); + + metrics->SetUserPermitsUpload(enabled); + if (enabled) + metrics->Start(); + } } InstallJankometer(parsed_command_line); @@ -559,7 +572,7 @@ int BrowserMain(CommandLine &parsed_command_line, int show_command, } if (metrics) - metrics->SetRecording(false); // Force persistent save. + metrics->Stop(); // browser_shutdown takes care of deleting browser_process, so we need to // release it. |