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/persistent_integer.cc b/metricsd/persistent_integer.cc
index 9fa5c1e..e849f00 100644
--- a/metricsd/persistent_integer.cc
+++ b/metricsd/persistent_integer.cc
@@ -28,18 +28,14 @@
 namespace chromeos_metrics {
 
 // Static class member instantiation.
-bool PersistentInteger::testing_ = false;
+std::string PersistentInteger::metrics_directory_ = metrics::kMetricsDirectory;
 
 PersistentInteger::PersistentInteger(const std::string& name) :
       value_(0),
       version_(kVersion),
       name_(name),
       synced_(false) {
-  if (testing_) {
-    backing_file_name_ = name_;
-  } else {
-    backing_file_name_ = metrics::kMetricsDirectory + name_;
-  }
+  backing_file_name_ = metrics_directory_ + name_;
 }
 
 PersistentInteger::~PersistentInteger() {}
@@ -100,8 +96,8 @@
   return read_succeeded;
 }
 
-void PersistentInteger::SetTestingMode(bool testing) {
-  testing_ = testing;
+void PersistentInteger::SetMetricsDirectory(const std::string& directory) {
+  metrics_directory_ = directory;
 }