metrics: Fix metrics_uploader on VMs
metrics_uploader must be in testing mode so that it does not try to grab the
real hardware id (not available on VMs).
BUG=chromium:413256
TEST=FEATURES=test emerge-amd64-generic metrics.
TEST=platform_MetricsUploader succeeds on a gizmo VM.
Change-Id: I9e508c8661dfdb7933161b0d41ef4cf9bd7db2c6
Reviewed-on: https://chromium-review.googlesource.com/217760
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/metrics/metrics_daemon.cc b/metrics/metrics_daemon.cc
index 07c3220..c0c77fa 100644
--- a/metrics/metrics_daemon.cc
+++ b/metrics/metrics_daemon.cc
@@ -187,6 +187,8 @@
}
void MetricsDaemon::RunUploaderTest() {
+ upload_service_.reset(new UploadService(testing_));
+ upload_service_->Init();
upload_service_->UploadEvent();
}
@@ -311,7 +313,7 @@
g_timeout_add(kUpdateStatsIntervalMs, &HandleUpdateStatsTimeout, this);
if (uploader_active) {
- upload_service_.reset(new UploadService());
+ upload_service_.reset(new UploadService(testing_));
upload_service_->Init();
}
}