metricsd: Make the unit tests pass.
This cleans up the unit tests and update them to pass.
Cleaned up:
* removed the irrelevant bits.
* Used ScopedTempDir for all test specific files (instead of the current
directory).
* Update some objects to make them more easily testable.
* Group all the test in a single binary and use bionic's test runner.
BUG: 23682444
Change-Id: I289e3a5ff89968fdecd4a156e93bc38bbc25f58b
diff --git a/metricsd/metrics_library.cc b/metricsd/metrics_library.cc
index c1998a6..5687f1b 100644
--- a/metricsd/metrics_library.cc
+++ b/metricsd/metrics_library.cc
@@ -140,6 +140,12 @@
uma_events_file_ = metrics::kMetricsEventsFilePath;
}
+void MetricsLibrary::InitForTest(const std::string& uma_events_file,
+ const std::string& consent_file) {
+ uma_events_file_ = uma_events_file;
+ consent_file_ = consent_file;
+}
+
bool MetricsLibrary::SendToUMA(const std::string& name,
int sample,
int min,