Merge "crash_reporter: Fix header include paths"
diff --git a/metrics/constants.h b/metrics/constants.h
new file mode 100644
index 0000000..d44a74f
--- /dev/null
+++ b/metrics/constants.h
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2015 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef METRICS_CONSTANTS_H_
+#define METRICS_CONSTANTS_H_
+
+namespace metrics {
+static const char kMetricsDirectory[] = "/data/misc/metrics/";
+static const char kMetricsEventsFilePath[] = "/data/misc/metrics/uma-events";
+static const char kMetricsGUIDFilePath[] = "/data/misc/metrics/Sysinfo.GUID";
+static const char kMetricsServer[] = "http://clients4.google.com/uma/v2";
+static const char kConsentFilePath[] = "/data/misc/metrics/enabled";
+}  // namespace metrics
+
+#endif  // METRICS_CONSTANTS_H_
diff --git a/metrics/c_metrics_library.h b/metrics/include/metrics/c_metrics_library.h
similarity index 100%
rename from metrics/c_metrics_library.h
rename to metrics/include/metrics/c_metrics_library.h
diff --git a/metrics/metrics_library.h b/metrics/include/metrics/metrics_library.h
similarity index 93%
rename from metrics/metrics_library.h
rename to metrics/include/metrics/metrics_library.h
index a90f3e6..1c124d2 100644
--- a/metrics/metrics_library.h
+++ b/metrics/include/metrics/metrics_library.h
@@ -14,8 +14,6 @@
 #include <base/memory/scoped_ptr.h>
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
-#include "policy/libpolicy.h"
-
 class MetricsLibraryInterface {
  public:
   virtual void Init() = 0;
@@ -28,7 +26,7 @@
   virtual ~MetricsLibraryInterface() {}
 };
 
-// Library used to send metrics to both Autotest and Chrome/UMA.
+// Library used to send metrics to Chrome/UMA.
 class MetricsLibrary : public MetricsLibraryInterface {
  public:
   MetricsLibrary();
@@ -109,9 +107,6 @@
   // number in the histograms dashboard).
   bool SendCrosEventToUMA(const std::string& event);
 
-  // Sends to Autotest and returns true on success.
-  static bool SendToAutotest(const std::string& name, int value);
-
  private:
   friend class CMetricsLibraryTest;
   friend class MetricsLibraryTest;
@@ -130,9 +125,6 @@
                        char* buffer, int buffer_size,
                        bool* result);
 
-  // This function is used by tests only to mock the device policies.
-  void SetPolicyProvider(policy::PolicyProvider* provider);
-
   // Time at which we last checked if metrics were enabled.
   static time_t cached_enabled_time_;
 
@@ -142,8 +134,6 @@
   std::string uma_events_file_;
   std::string consent_file_;
 
-  scoped_ptr<policy::PolicyProvider> policy_provider_;
-
   DISALLOW_COPY_AND_ASSIGN(MetricsLibrary);
 };
 
diff --git a/metrics/metrics_client.cc b/metrics/metrics_client.cc
index bbe9dcd..b587e3a 100644
--- a/metrics/metrics_client.cc
+++ b/metrics/metrics_client.cc
@@ -19,17 +19,15 @@
 
 void ShowUsage() {
   fprintf(stderr,
-          "Usage:  metrics_client [-ab] [-t] name sample min max nbuckets\n"
-          "        metrics_client [-ab] -e   name sample max\n"
-          "        metrics_client [-ab] -s   name sample\n"
-          "        metrics_client [-ab] -v   event\n"
+          "Usage:  metrics_client [-t] name sample min max nbuckets\n"
+          "        metrics_client -e   name sample max\n"
+          "        metrics_client -s   name sample\n"
+          "        metrics_client -v   event\n"
           "        metrics_client -u action\n"
           "        metrics_client [-cg]\n"
           "\n"
-          "  default: send metric with integer values to Chrome only\n"
+          "  default: send metric with integer values \n"
           "           |min| > 0, |min| <= sample < |max|\n"
-          "  -a: send metric (name/sample) to Autotest only\n"
-          "  -b: send metric to both Chrome and Autotest\n"
           "  -c: return exit status 0 if user consents to stats, 1 otherwise,\n"
           "      in guest mode always return 1\n"
           "  -e: send linear/enumeration histogram data\n"
@@ -64,9 +62,7 @@
 static int SendStats(char* argv[],
                      int name_index,
                      enum Mode mode,
-                     bool secs_to_msecs,
-                     bool send_to_autotest,
-                     bool send_to_chrome) {
+                     bool secs_to_msecs) {
   const char* name = argv[name_index];
   int sample;
   if (secs_to_msecs) {
@@ -75,25 +71,18 @@
     sample = ParseInt(argv[name_index + 1]);
   }
 
-  // Send metrics
-  if (send_to_autotest) {
-    MetricsLibrary::SendToAutotest(name, sample);
-  }
-
-  if (send_to_chrome) {
-    MetricsLibrary metrics_lib;
-    metrics_lib.Init();
-    if (mode == kModeSendSparseSample) {
-      metrics_lib.SendSparseToUMA(name, sample);
-    } else if (mode == kModeSendEnumSample) {
-      int max = ParseInt(argv[name_index + 2]);
-      metrics_lib.SendEnumToUMA(name, sample, max);
-    } else {
-      int min = ParseInt(argv[name_index + 2]);
-      int max = ParseInt(argv[name_index + 3]);
-      int nbuckets = ParseInt(argv[name_index + 4]);
-      metrics_lib.SendToUMA(name, sample, min, max, nbuckets);
-    }
+  MetricsLibrary metrics_lib;
+  metrics_lib.Init();
+  if (mode == kModeSendSparseSample) {
+    metrics_lib.SendSparseToUMA(name, sample);
+  } else if (mode == kModeSendEnumSample) {
+    int max = ParseInt(argv[name_index + 2]);
+    metrics_lib.SendEnumToUMA(name, sample, max);
+  } else {
+    int min = ParseInt(argv[name_index + 2]);
+    int max = ParseInt(argv[name_index + 3]);
+    int nbuckets = ParseInt(argv[name_index + 4]);
+    metrics_lib.SendToUMA(name, sample, min, max, nbuckets);
   }
   return 0;
 }
@@ -133,22 +122,12 @@
 
 int main(int argc, char** argv) {
   enum Mode mode = kModeSendSample;
-  bool send_to_autotest = false;
-  bool send_to_chrome = true;
   bool secs_to_msecs = false;
 
   // Parse arguments
   int flag;
   while ((flag = getopt(argc, argv, "abcegstuv")) != -1) {
     switch (flag) {
-      case 'a':
-        send_to_autotest = true;
-        send_to_chrome = false;
-        break;
-      case 'b':
-        send_to_chrome = true;
-        send_to_autotest = true;
-        break;
       case 'c':
         mode = kModeHasConsent;
         break;
@@ -203,9 +182,7 @@
       return SendStats(argv,
                        arg_index,
                        mode,
-                       secs_to_msecs,
-                       send_to_autotest,
-                       send_to_chrome);
+                       secs_to_msecs);
     case kModeSendUserAction:
       return SendUserAction(argv, arg_index);
     case kModeSendCrosEvent:
diff --git a/metrics/metrics_daemon.cc b/metrics/metrics_daemon.cc
index 880e90c..2881f69 100644
--- a/metrics/metrics_daemon.cc
+++ b/metrics/metrics_daemon.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/metrics_daemon.h"
+#include "metrics_daemon.h"
 
 #include <fcntl.h>
 #include <inttypes.h>
@@ -11,6 +11,7 @@
 #include <sysexits.h>
 #include <time.h>
 
+#include <base/bind.h>
 #include <base/files/file_path.h>
 #include <base/files/file_util.h>
 #include <base/hash.h>
@@ -20,7 +21,6 @@
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <base/sys_info.h>
-#include <chromeos/dbus/service_constants.h>
 #include <dbus/dbus.h>
 #include <dbus/message.h>
 #include "uploader/upload_service.h"
@@ -220,7 +220,6 @@
 void MetricsDaemon::Init(bool testing,
                          bool uploader_active,
                          MetricsLibraryInterface* metrics_lib,
-                         const string& diskstats_path,
                          const string& vmstats_path,
                          const string& scaling_max_freq_path,
                          const string& cpuinfo_max_freq_path,
@@ -279,14 +278,9 @@
   weekly_cycle_.reset(new PersistentInteger("weekly.cycle"));
   version_cycle_.reset(new PersistentInteger("version.cycle"));
 
-  diskstats_path_ = diskstats_path;
   vmstats_path_ = vmstats_path;
   scaling_max_freq_path_ = scaling_max_freq_path;
   cpuinfo_max_freq_path_ = cpuinfo_max_freq_path;
-
-  // If testing, initialize Stats Reporter without connecting DBus
-  if (testing_)
-    StatsReporterInit();
 }
 
 int MetricsDaemon::OnInit() {
@@ -294,13 +288,6 @@
   if (return_code != EX_OK)
     return return_code;
 
-  StatsReporterInit();
-
-  // Start collecting meminfo stats.
-  ScheduleMeminfoCallback(kMetricMeminfoInterval);
-  memuse_final_time_ = GetActiveTime() + kMemuseIntervals[0];
-  ScheduleMemuseCallback(kMemuseIntervals[0]);
-
   if (testing_)
     return EX_OK;
 
@@ -329,11 +316,6 @@
     return EX_UNAVAILABLE;
   }
 
-  base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
-      base::Bind(&MetricsDaemon::HandleUpdateStatsTimeout,
-                 base::Unretained(this)),
-      base::TimeDelta::FromMilliseconds(kUpdateStatsIntervalMs));
-
   if (uploader_active_) {
     if (IsOnOfficialBuild()) {
       LOG(INFO) << "uploader enabled";
@@ -520,41 +502,6 @@
       base::TimeDelta::FromSeconds(wait));
 }
 
-bool MetricsDaemon::DiskStatsReadStats(uint64_t* read_sectors,
-                                       uint64_t* write_sectors) {
-  int nchars;
-  int nitems;
-  bool success = false;
-  char line[200];
-  if (diskstats_path_.empty()) {
-    return false;
-  }
-  int file = HANDLE_EINTR(open(diskstats_path_.c_str(), O_RDONLY));
-  if (file < 0) {
-    PLOG(WARNING) << "cannot open " << diskstats_path_;
-    return false;
-  }
-  nchars = HANDLE_EINTR(read(file, line, sizeof(line)));
-  if (nchars < 0) {
-    PLOG(WARNING) << "cannot read from " << diskstats_path_;
-    return false;
-  } else {
-    LOG_IF(WARNING, nchars == sizeof(line))
-        << "line too long in " << diskstats_path_;
-    line[nchars] = '\0';
-    nitems = sscanf(line, "%*d %*d %" PRIu64 " %*d %*d %*d %" PRIu64,
-                    read_sectors, write_sectors);
-    if (nitems == 2) {
-      success = true;
-    } else {
-      LOG(WARNING) << "found " << nitems << " items in "
-                   << diskstats_path_ << ", expected 2";
-    }
-  }
-  IGNORE_EINTR(close(file));
-  return success;
-}
-
 bool MetricsDaemon::VmStatsParseStats(const char* stats,
                                       struct VmstatRecord* record) {
   // a mapping of string name to field in VmstatRecord and whether we found it
diff --git a/metrics/metrics_daemon.h b/metrics/metrics_daemon.h
index b1b2d11..bcfec14 100644
--- a/metrics/metrics_daemon.h
+++ b/metrics/metrics_daemon.h
@@ -18,7 +18,7 @@
 #include <gtest/gtest_prod.h>  // for FRIEND_TEST
 
 #include "metrics/metrics_library.h"
-#include "metrics/persistent_integer.h"
+#include "persistent_integer.h"
 #include "uploader/upload_service.h"
 
 using chromeos_metrics::PersistentInteger;
@@ -32,7 +32,6 @@
   void Init(bool testing,
             bool uploader_active,
             MetricsLibraryInterface* metrics_lib,
-            const std::string& diskstats_path,
             const std::string& vmstats_path,
             const std::string& cpuinfo_max_freq_path,
             const std::string& scaling_max_freq_path,
@@ -356,7 +355,6 @@
   scoped_ptr<PersistentInteger> unclean_shutdowns_daily_count_;
   scoped_ptr<PersistentInteger> unclean_shutdowns_weekly_count_;
 
-  std::string diskstats_path_;
   std::string vmstats_path_;
   std::string scaling_max_freq_path_;
   std::string cpuinfo_max_freq_path_;
diff --git a/metrics/metrics_daemon_main.cc b/metrics/metrics_daemon_main.cc
index 1f64ef3..01a6f7b 100644
--- a/metrics/metrics_daemon_main.cc
+++ b/metrics/metrics_daemon_main.cc
@@ -8,40 +8,15 @@
 #include <base/strings/string_util.h>
 #include <chromeos/flag_helper.h>
 #include <chromeos/syslog_logging.h>
-#include <rootdev/rootdev.h>
 
-#include "metrics/metrics_daemon.h"
+#include "constants.h"
+#include "metrics_daemon.h"
 
 const char kScalingMaxFreqPath[] =
     "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq";
 const char kCpuinfoMaxFreqPath[] =
     "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq";
 
-// Returns the path to the disk stats in the sysfs.  Returns the null string if
-// it cannot find the disk stats file.
-static
-const std::string MetricsMainDiskStatsPath() {
-  char dev_path_cstr[PATH_MAX];
-  std::string dev_prefix = "/dev/";
-  std::string dev_path;
-  std::string dev_name;
-
-  int ret = rootdev(dev_path_cstr, sizeof(dev_path_cstr), true, true);
-  if (ret != 0) {
-    LOG(WARNING) << "error " << ret << " determining root device";
-    return "";
-  }
-  dev_path = dev_path_cstr;
-  // Check that rootdev begins with "/dev/".
-  if (!base::StartsWithASCII(dev_path, dev_prefix, false)) {
-    LOG(WARNING) << "unexpected root device " << dev_path;
-    return "";
-  }
-  // Get the device name, e.g. "sda" from "/dev/sda".
-  dev_name = dev_path.substr(dev_prefix.length());
-  return "/sys/class/block/" + dev_name + "/stat";
-}
-
 int main(int argc, char** argv) {
   DEFINE_bool(daemon, true, "run as daemon (use -nodaemon for debugging)");
 
@@ -60,10 +35,10 @@
                "Interval at which metrics_daemon sends the metrics. (needs "
                "-uploader)");
   DEFINE_string(server,
-                "https://clients4.google.com/uma/v2",
+                metrics::kMetricsServer,
                 "Server to upload the metrics to. (needs -uploader)");
   DEFINE_string(metrics_file,
-                "/var/lib/metrics/uma-events",
+                metrics::kMetricsEventsFilePath,
                 "File to use as a proxy for uploading the metrics");
   DEFINE_string(config_root,
                 "/", "Root of the configuration files (testing only)");
@@ -84,7 +59,6 @@
   daemon.Init(FLAGS_uploader_test,
               FLAGS_uploader | FLAGS_uploader_test,
               &metrics_lib,
-              MetricsMainDiskStatsPath(),
               "/proc/vmstat",
               kScalingMaxFreqPath,
               kCpuinfoMaxFreqPath,
diff --git a/metrics/metrics_daemon_test.cc b/metrics/metrics_daemon_test.cc
index 7dafbd6..5aa7ab8 100644
--- a/metrics/metrics_daemon_test.cc
+++ b/metrics/metrics_daemon_test.cc
@@ -15,9 +15,9 @@
 #include <chromeos/dbus/service_constants.h>
 #include <gtest/gtest.h>
 
-#include "metrics/metrics_daemon.h"
-#include "metrics/metrics_library_mock.h"
-#include "metrics/persistent_integer_mock.h"
+#include "metrics_daemon.h"
+#include "metrics_library_mock.h"
+#include "persistent_integer_mock.h"
 
 using base::FilePath;
 using base::StringPrintf;
@@ -44,8 +44,6 @@
 static const char kFakeVmStatsName[] = "fake-vm-stats";
 static const char kFakeScalingMaxFreqPath[] = "fake-scaling-max-freq";
 static const char kFakeCpuinfoMaxFreqPath[] = "fake-cpuinfo-max-freq";
-static const char kMetricsServer[] = "https://clients4.google.com/uma/v2";
-static const char kMetricsFilePath[] = "/var/lib/metrics/uma-events";
 
 class MetricsDaemonTest : public testing::Test {
  protected:
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index 70c8eac..f777f28 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -13,14 +13,10 @@
 #include <cstdio>
 #include <cstring>
 
-#include "metrics/serialization/metric_sample.h"
-#include "metrics/serialization/serialization_utils.h"
+#include "constants.h"
+#include "serialization/metric_sample.h"
+#include "serialization/serialization_utils.h"
 
-#include "policy/device_policy.h"
-
-static const char kAutotestPath[] = "/var/log/metrics/autotest-events";
-static const char kUMAEventsPath[] = "/var/lib/metrics/uma-events";
-static const char kConsentFile[] = "/home/chronos/Consent To Send Stats";
 static const char kCrosEventHistogramName[] = "Platform.CrOSEvent";
 static const int kCrosEventHistogramMax = 100;
 
@@ -48,7 +44,7 @@
 time_t MetricsLibrary::cached_enabled_time_ = 0;
 bool MetricsLibrary::cached_enabled_ = false;
 
-MetricsLibrary::MetricsLibrary() : consent_file_(kConsentFile) {}
+MetricsLibrary::MetricsLibrary() : consent_file_(metrics::kConsentFilePath) {}
 MetricsLibrary::~MetricsLibrary() {}
 
 // We take buffer and buffer_size as parameters in order to simplify testing
@@ -123,47 +119,13 @@
   time_t this_check_time = time(nullptr);
   if (this_check_time != cached_enabled_time_) {
     cached_enabled_time_ = this_check_time;
-
-    if (!policy_provider_.get())
-      policy_provider_.reset(new policy::PolicyProvider());
-    policy_provider_->Reload();
-    // We initialize with the default value which is false and will be preserved
-    // if the policy is not set.
-    bool enabled = false;
-    bool has_policy = false;
-    if (policy_provider_->device_policy_is_loaded()) {
-      has_policy =
-          policy_provider_->GetDevicePolicy().GetMetricsEnabled(&enabled);
-    }
-    // If policy couldn't be loaded or the metrics policy is not set we should
-    // still respect the consent file if it is present for migration purposes.
-    // TODO(pastarmovj)
-    if (!has_policy) {
-      enabled = stat(consent_file_.c_str(), &stat_buffer) >= 0;
-    }
-
-    if (enabled && !IsGuestMode())
-      cached_enabled_ = true;
-    else
-      cached_enabled_ = false;
+    cached_enabled_ = stat(consent_file_.c_str(), &stat_buffer) >= 0;
   }
   return cached_enabled_;
 }
 
 void MetricsLibrary::Init() {
-  uma_events_file_ = kUMAEventsPath;
-}
-
-bool MetricsLibrary::SendToAutotest(const std::string& name, int value) {
-  FILE* autotest_file = fopen(kAutotestPath, "a+");
-  if (autotest_file == nullptr) {
-    PLOG(ERROR) << kAutotestPath << ": fopen";
-    return false;
-  }
-
-  fprintf(autotest_file, "%s=%d\n", name.c_str(), value);
-  fclose(autotest_file);
-  return true;
+  uma_events_file_ = metrics::kMetricsEventsFilePath;
 }
 
 bool MetricsLibrary::SendToUMA(const std::string& name,
@@ -174,34 +136,30 @@
   return metrics::SerializationUtils::WriteMetricToFile(
       *metrics::MetricSample::HistogramSample(name, sample, min, max, nbuckets)
            .get(),
-      kUMAEventsPath);
+      metrics::kMetricsEventsFilePath);
 }
 
 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
                                    int max) {
   return metrics::SerializationUtils::WriteMetricToFile(
       *metrics::MetricSample::LinearHistogramSample(name, sample, max).get(),
-      kUMAEventsPath);
+      metrics::kMetricsEventsFilePath);
 }
 
 bool MetricsLibrary::SendSparseToUMA(const std::string& name, int sample) {
   return metrics::SerializationUtils::WriteMetricToFile(
       *metrics::MetricSample::SparseHistogramSample(name, sample).get(),
-      kUMAEventsPath);
+      metrics::kMetricsEventsFilePath);
 }
 
 bool MetricsLibrary::SendUserActionToUMA(const std::string& action) {
   return metrics::SerializationUtils::WriteMetricToFile(
-      *metrics::MetricSample::UserActionSample(action).get(), kUMAEventsPath);
+      *metrics::MetricSample::UserActionSample(action).get(), metrics::kMetricsEventsFilePath);
 }
 
 bool MetricsLibrary::SendCrashToUMA(const char *crash_kind) {
   return metrics::SerializationUtils::WriteMetricToFile(
-      *metrics::MetricSample::CrashSample(crash_kind).get(), kUMAEventsPath);
-}
-
-void MetricsLibrary::SetPolicyProvider(policy::PolicyProvider* provider) {
-  policy_provider_.reset(provider);
+      *metrics::MetricSample::CrashSample(crash_kind).get(), metrics::kMetricsEventsFilePath);
 }
 
 bool MetricsLibrary::SendCrosEventToUMA(const std::string& event) {
diff --git a/metrics/persistent_integer.cc b/metrics/persistent_integer.cc
index dd38f1e..0dcd52a 100644
--- a/metrics/persistent_integer.cc
+++ b/metrics/persistent_integer.cc
@@ -2,21 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/persistent_integer.h"
+#include "persistent_integer.h"
 
 #include <fcntl.h>
 
 #include <base/logging.h>
 #include <base/posix/eintr_wrapper.h>
 
+#include "constants.h"
 #include "metrics/metrics_library.h"
 
-namespace {
-
-// The directory for the persistent storage.
-const char kBackingFilesDirectory[] = "/var/lib/metrics/";
-
-}
 
 namespace chromeos_metrics {
 
@@ -31,7 +26,7 @@
   if (testing_) {
     backing_file_name_ = name_;
   } else {
-    backing_file_name_ = kBackingFilesDirectory + name_;
+    backing_file_name_ = metrics::kMetricsDirectory + name_;
   }
 }
 
diff --git a/metrics/persistent_integer_mock.h b/metrics/persistent_integer_mock.h
index 2061e55..31bfc35 100644
--- a/metrics/persistent_integer_mock.h
+++ b/metrics/persistent_integer_mock.h
@@ -9,7 +9,7 @@
 
 #include <gmock/gmock.h>
 
-#include "metrics/persistent_integer.h"
+#include "persistent_integer.h"
 
 namespace chromeos_metrics {
 
diff --git a/metrics/persistent_integer_test.cc b/metrics/persistent_integer_test.cc
index a56aede..4fccb72 100644
--- a/metrics/persistent_integer_test.cc
+++ b/metrics/persistent_integer_test.cc
@@ -8,7 +8,7 @@
 #include <base/files/file_enumerator.h>
 #include <base/files/file_util.h>
 
-#include "metrics/persistent_integer.h"
+#include "persistent_integer.h"
 
 const char kBackingFileName[] = "1.pibakf";
 const char kBackingFilePattern[] = "*.pibakf";
diff --git a/metrics/serialization/metric_sample.cc b/metrics/serialization/metric_sample.cc
index 5447497..bc6583d 100644
--- a/metrics/serialization/metric_sample.cc
+++ b/metrics/serialization/metric_sample.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/serialization/metric_sample.h"
+#include "serialization/metric_sample.h"
 
 #include <string>
 #include <vector>
diff --git a/metrics/serialization/serialization_utils.cc b/metrics/serialization/serialization_utils.cc
index 9aa076a..d18dcd7 100644
--- a/metrics/serialization/serialization_utils.cc
+++ b/metrics/serialization/serialization_utils.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/serialization/serialization_utils.h"
+#include "serialization/serialization_utils.h"
 
 #include <sys/file.h>
 
@@ -17,7 +17,7 @@
 #include "base/memory/scoped_vector.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
-#include "metrics/serialization/metric_sample.h"
+#include "serialization/metric_sample.h"
 
 #define READ_WRITE_ALL_FILE_FLAGS \
   (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
diff --git a/metrics/serialization/serialization_utils_unittest.cc b/metrics/serialization/serialization_utils_unittest.cc
index 34d76cf..fb802bc 100644
--- a/metrics/serialization/serialization_utils_unittest.cc
+++ b/metrics/serialization/serialization_utils_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/serialization/serialization_utils.h"
+#include "serialization/serialization_utils.h"
 
 #include <base/files/file_util.h>
 #include <base/files/scoped_temp_dir.h>
@@ -10,7 +10,7 @@
 #include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
 
-#include "metrics/serialization/metric_sample.h"
+#include "serialization/metric_sample.h"
 
 namespace metrics {
 namespace {
diff --git a/metrics/timer.cc b/metrics/timer.cc
index 99f68fe..ce4bf67 100644
--- a/metrics/timer.cc
+++ b/metrics/timer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/timer.h"
+#include "timer.h"
 
 #include <string>
 
diff --git a/metrics/timer_mock.h b/metrics/timer_mock.h
index 2f2d0f4..ed76f12 100644
--- a/metrics/timer_mock.h
+++ b/metrics/timer_mock.h
@@ -9,7 +9,7 @@
 
 #include <gmock/gmock.h>
 
-#include "metrics/timer.h"
+#include "timer.h"
 
 namespace chromeos_metrics {
 
diff --git a/metrics/timer_test.cc b/metrics/timer_test.cc
index ec6c6bd..b1689bf 100644
--- a/metrics/timer_test.cc
+++ b/metrics/timer_test.cc
@@ -8,9 +8,9 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-#include "metrics/metrics_library_mock.h"
-#include "metrics/timer.h"
-#include "metrics/timer_mock.h"
+#include "metrics_library_mock.h"
+#include "timer.h"
+#include "timer_mock.h"
 
 using ::testing::_;
 using ::testing::Return;
diff --git a/metrics/uploader/metrics_hashes.cc b/metrics/uploader/metrics_hashes.cc
index 87405a3..f9d0cfe 100644
--- a/metrics/uploader/metrics_hashes.cc
+++ b/metrics/uploader/metrics_hashes.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/metrics_hashes.h"
+#include "uploader/metrics_hashes.h"
 
 #include "base/logging.h"
 #include "base/md5.h"
diff --git a/metrics/uploader/metrics_hashes_unittest.cc b/metrics/uploader/metrics_hashes_unittest.cc
index f7e390f..8cdc7a9 100644
--- a/metrics/uploader/metrics_hashes_unittest.cc
+++ b/metrics/uploader/metrics_hashes_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/metrics_hashes.h"
+#include "uploader/metrics_hashes.h"
 
 #include <base/format_macros.h>
 #include <base/macros.h>
diff --git a/metrics/uploader/metrics_log.cc b/metrics/uploader/metrics_log.cc
index 4d493b8..6f11f8a 100644
--- a/metrics/uploader/metrics_log.cc
+++ b/metrics/uploader/metrics_log.cc
@@ -6,7 +6,7 @@
 
 #include <string>
 
-#include "metrics/uploader/proto/system_profile.pb.h"
+#include "uploader/proto/system_profile.pb.h"
 #include "uploader/system_profile_setter.h"
 
 // We use default values for the MetricsLogBase constructor as the setter will
diff --git a/metrics/uploader/metrics_log.h b/metrics/uploader/metrics_log.h
index 5796325..a62798f 100644
--- a/metrics/uploader/metrics_log.h
+++ b/metrics/uploader/metrics_log.h
@@ -9,7 +9,7 @@
 
 #include <base/macros.h>
 
-#include "metrics/uploader/metrics_log_base.h"
+#include "uploader/metrics_log_base.h"
 
 // This file defines a set of user experience metrics data recorded by
 // the MetricsService. This is the unit of data that is sent to the server.
diff --git a/metrics/uploader/metrics_log_base.cc b/metrics/uploader/metrics_log_base.cc
index 7fe1ae1..3ae01e8 100644
--- a/metrics/uploader/metrics_log_base.cc
+++ b/metrics/uploader/metrics_log_base.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/metrics_log_base.h"
+#include "uploader/metrics_log_base.h"
 
 #include "base/metrics/histogram_base.h"
 #include "base/metrics/histogram_samples.h"
-#include "metrics/uploader/metrics_hashes.h"
-#include "metrics/uploader/proto/histogram_event.pb.h"
-#include "metrics/uploader/proto/system_profile.pb.h"
-#include "metrics/uploader/proto/user_action_event.pb.h"
+#include "uploader/metrics_hashes.h"
+#include "uploader/proto/histogram_event.pb.h"
+#include "uploader/proto/system_profile.pb.h"
+#include "uploader/proto/user_action_event.pb.h"
 
 using base::Histogram;
 using base::HistogramBase;
diff --git a/metrics/uploader/metrics_log_base.h b/metrics/uploader/metrics_log_base.h
index e871c0f..4173335 100644
--- a/metrics/uploader/metrics_log_base.h
+++ b/metrics/uploader/metrics_log_base.h
@@ -13,7 +13,7 @@
 #include "base/macros.h"
 #include "base/metrics/histogram.h"
 #include "base/time/time.h"
-#include "metrics/uploader/proto/chrome_user_metrics_extension.pb.h"
+#include "uploader/proto/chrome_user_metrics_extension.pb.h"
 
 namespace base {
 class HistogramSamples;
diff --git a/metrics/uploader/metrics_log_base_unittest.cc b/metrics/uploader/metrics_log_base_unittest.cc
index 5da428a..dc03f00 100644
--- a/metrics/uploader/metrics_log_base_unittest.cc
+++ b/metrics/uploader/metrics_log_base_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/metrics_log_base.h"
+#include "uploader/metrics_log_base.h"
 
 #include <string>
 
@@ -10,7 +10,7 @@
 #include <base/metrics/sample_vector.h>
 #include <gtest/gtest.h>
 
-#include "metrics/uploader/proto/chrome_user_metrics_extension.pb.h"
+#include "uploader/proto/chrome_user_metrics_extension.pb.h"
 
 namespace metrics {
 
diff --git a/metrics/uploader/mock/sender_mock.h b/metrics/uploader/mock/sender_mock.h
index 159b645..0a15d61 100644
--- a/metrics/uploader/mock/sender_mock.h
+++ b/metrics/uploader/mock/sender_mock.h
@@ -8,7 +8,7 @@
 #include <string>
 
 #include "base/compiler_specific.h"
-#include "metrics/uploader/proto/chrome_user_metrics_extension.pb.h"
+#include "uploader/proto/chrome_user_metrics_extension.pb.h"
 #include "uploader/sender.h"
 
 class SenderMock : public Sender {
diff --git a/metrics/uploader/proto/chrome_user_metrics_extension.proto b/metrics/uploader/proto/chrome_user_metrics_extension.proto
index f712fc9..2c91f9f 100644
--- a/metrics/uploader/proto/chrome_user_metrics_extension.proto
+++ b/metrics/uploader/proto/chrome_user_metrics_extension.proto
@@ -14,9 +14,9 @@
 
 package metrics;
 
-import "histogram_event.proto";
-import "system_profile.proto";
-import "user_action_event.proto";
+import "system/core/metrics/uploader/proto/histogram_event.proto";
+import "system/core/metrics/uploader/proto/system_profile.proto";
+import "system/core/metrics/uploader/proto/user_action_event.proto";
 
 // Next tag: 13
 message ChromeUserMetricsExtension {
diff --git a/metrics/uploader/sender_http.cc b/metrics/uploader/sender_http.cc
index 8488b66..a740310 100644
--- a/metrics/uploader/sender_http.cc
+++ b/metrics/uploader/sender_http.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/sender_http.h"
+#include "uploader/sender_http.h"
 
 #include <string>
 
diff --git a/metrics/uploader/sender_http.h b/metrics/uploader/sender_http.h
index 4880b28..380cad8 100644
--- a/metrics/uploader/sender_http.h
+++ b/metrics/uploader/sender_http.h
@@ -9,7 +9,7 @@
 
 #include <base/macros.h>
 
-#include "metrics/uploader/sender.h"
+#include "uploader/sender.h"
 
 // Sender implemented using http_utils from libchromeos
 class HttpSender : public Sender {
diff --git a/metrics/uploader/system_profile_cache.cc b/metrics/uploader/system_profile_cache.cc
index ea4a38c..82401c6 100644
--- a/metrics/uploader/system_profile_cache.cc
+++ b/metrics/uploader/system_profile_cache.cc
@@ -2,27 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/system_profile_cache.h"
+#include "uploader/system_profile_cache.h"
 
+#include <base/files/file_util.h>
+#include <base/guid.h>
+#include <base/logging.h>
+#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
+#include <base/sys_info.h>
 #include <string>
 #include <vector>
 
-#include "base/files/file_util.h"
-#include "base/guid.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/sys_info.h"
-#include "metrics/persistent_integer.h"
-#include "metrics/uploader/metrics_log_base.h"
-#include "metrics/uploader/proto/chrome_user_metrics_extension.pb.h"
-#include "vboot/crossystem.h"
+#include "constants.h"
+#include "persistent_integer.h"
+#include "uploader/metrics_log_base.h"
+#include "uploader/proto/chrome_user_metrics_extension.pb.h"
 
 namespace {
 
-const char kPersistentGUIDFile[] = "/var/lib/metrics/Sysinfo.GUID";
 const char kPersistentSessionIdFilename[] = "Sysinfo.SessionId";
-const char kProductIdFieldName[] = "GOOGLE_METRICS_PRODUCT_ID";
 
 }  // namespace
 
@@ -63,43 +61,24 @@
   CHECK(!initialized_)
       << "this should be called only once in the metrics_daemon lifetime.";
 
-  std::string chromeos_version;
-  std::string board;
-  std::string build_type;
-  if (!base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_NAME",
-                                         &profile_.os_name) ||
-      !base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_VERSION",
-                                         &profile_.os_version) ||
-      !base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_BOARD", &board) ||
-      !base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_BUILD_TYPE",
-                                         &build_type) ||
-      !GetChromeOSVersion(&chromeos_version) ||
-      !GetHardwareId(&profile_.hardware_class)) {
-    DLOG(ERROR) << "failing to initialize profile cache";
+  std::string channel;
+  if (!base::SysInfo::GetLsbReleaseValue("BRILLO_CHANNEL", &channel) ||
+      !base::SysInfo::GetLsbReleaseValue("BRILLO_VERSION", &profile_.version) ||
+      !base::SysInfo::GetLsbReleaseValue("BRILLO_BUILD_TARGET_ID",
+                                         &profile_.build_target_id)) {
+    LOG(ERROR) << "Could not initialize system profile.";
     return false;
   }
 
-  std::string channel_string;
-  base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_TRACK", &channel_string);
-  profile_.channel = ProtoChannelFromString(channel_string);
-
-  profile_.app_version = chromeos_version + " (" + build_type + ")" +
-      ChannelToString(profile_.channel) + " " + board;
-
-  // If the product id is not defined, use the default one from the protobuf.
-  profile_.product_id = metrics::ChromeUserMetricsExtension::CHROME;
-  if (GetProductId(&profile_.product_id)) {
-    DLOG(INFO) << "Set the product id to " << profile_.product_id;
-  }
-
   profile_.client_id =
-      testing_ ? "client_id_test" : GetPersistentGUID(kPersistentGUIDFile);
+      testing_ ? "client_id_test" :
+      GetPersistentGUID(metrics::kMetricsGUIDFilePath);
+  profile_.hardware_class = "unknown";
+  profile_.channel = ProtoChannelFromString(channel);
 
   // Increment the session_id everytime we initialize this. If metrics_daemon
   // does not crash, this should correspond to the number of reboots of the
   // system.
-  // TODO(bsimonnet): Change this to map to the number of time system-services
-  // is started.
   session_id_->Add(1);
   profile_.session_id = static_cast<int32_t>(session_id_->Get());
 
@@ -123,21 +102,21 @@
   metrics_proto->set_session_id(profile_.session_id);
 
   // Sets the product id.
-  metrics_proto->set_product(profile_.product_id);
+  metrics_proto->set_product(9);
 
   metrics::SystemProfileProto* profile_proto =
       metrics_proto->mutable_system_profile();
   profile_proto->mutable_hardware()->set_hardware_class(
       profile_.hardware_class);
-  profile_proto->set_app_version(profile_.app_version);
+  profile_proto->set_app_version(profile_.version);
   profile_proto->set_channel(profile_.channel);
-
-  metrics::SystemProfileProto_OS* os = profile_proto->mutable_os();
-  os->set_name(profile_.os_name);
-  os->set_version(profile_.os_version);
+  metrics::SystemProfileProto_BrilloDeviceData* device_data =
+      profile_proto->mutable_brillo();
+  device_data->set_build_target_id(profile_.build_target_id);
 }
 
-std::string SystemProfileCache::GetPersistentGUID(const std::string& filename) {
+std::string SystemProfileCache::GetPersistentGUID(
+    const std::string& filename) {
   std::string guid;
   base::FilePath filepath(filename);
   if (!base::ReadFileToString(filepath, &guid)) {
@@ -149,87 +128,15 @@
   return guid;
 }
 
-bool SystemProfileCache::GetChromeOSVersion(std::string* version) {
-  if (testing_) {
-    *version = "0.0.0.0";
-    return true;
-  }
-
-  std::string milestone, build, branch, patch;
-  unsigned tmp;
-  if (base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_CHROME_MILESTONE",
-                                        &milestone) &&
-      base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_BUILD_NUMBER",
-                                        &build) &&
-      base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_BRANCH_NUMBER",
-                                        &branch) &&
-      base::SysInfo::GetLsbReleaseValue("CHROMEOS_RELEASE_PATCH_NUMBER",
-                                        &patch)) {
-    // Convert to uint to ensure those fields are positive numbers.
-    if (base::StringToUint(milestone, &tmp) &&
-        base::StringToUint(build, &tmp) &&
-        base::StringToUint(branch, &tmp) &&
-        base::StringToUint(patch, &tmp)) {
-      std::vector<std::string> parts = {milestone, build, branch, patch};
-      *version = JoinString(parts, '.');
-      return true;
-    }
-    DLOG(INFO) << "The milestone, build, branch or patch is not a positive "
-               << "number.";
-    return false;
-  }
-  DLOG(INFO) << "Field missing from /etc/lsb-release";
-  return false;
-}
-
-bool SystemProfileCache::GetHardwareId(std::string* hwid) {
-  CHECK(hwid);
-
-  if (testing_) {
-    // if we are in test mode, we do not call crossystem directly.
-    DLOG(INFO) << "skipping hardware id";
-    *hwid = "";
-    return true;
-  }
-
-  char buffer[128];
-  if (buffer != VbGetSystemPropertyString("hwid", buffer, sizeof(buffer))) {
-    LOG(ERROR) << "error getting hwid";
-    return false;
-  }
-
-  *hwid = std::string(buffer);
-  return true;
-}
-
-bool SystemProfileCache::GetProductId(int* product_id) const {
-  chromeos::OsReleaseReader reader;
-  if (testing_) {
-    base::FilePath root(config_root_);
-    reader.LoadTestingOnly(root);
-  } else {
-    reader.Load();
-  }
-
-  std::string id;
-  if (reader.GetString(kProductIdFieldName, &id)) {
-    CHECK(base::StringToInt(id, product_id)) << "Failed to convert product_id "
-                                             << id << " to int.";
-    return true;
-  }
-  return false;
-}
-
 metrics::SystemProfileProto_Channel SystemProfileCache::ProtoChannelFromString(
     const std::string& channel) {
-
-  if (channel == "stable-channel") {
+  if (channel == "stable") {
     return metrics::SystemProfileProto::CHANNEL_STABLE;
-  } else if (channel == "dev-channel") {
+  } else if (channel == "dev") {
     return metrics::SystemProfileProto::CHANNEL_DEV;
-  } else if (channel == "beta-channel") {
+  } else if (channel == "beta") {
     return metrics::SystemProfileProto::CHANNEL_BETA;
-  } else if (channel == "canary-channel") {
+  } else if (channel == "canary") {
     return metrics::SystemProfileProto::CHANNEL_CANARY;
   }
 
diff --git a/metrics/uploader/system_profile_cache.h b/metrics/uploader/system_profile_cache.h
index e7a7337..b6ff337 100644
--- a/metrics/uploader/system_profile_cache.h
+++ b/metrics/uploader/system_profile_cache.h
@@ -12,24 +12,21 @@
 #include "base/compiler_specific.h"
 #include "base/gtest_prod_util.h"
 #include "base/memory/scoped_ptr.h"
-#include "chromeos/osrelease_reader.h"
-#include "metrics/persistent_integer.h"
-#include "metrics/uploader/proto/system_profile.pb.h"
-#include "metrics/uploader/system_profile_setter.h"
+#include "persistent_integer.h"
+#include "uploader/proto/system_profile.pb.h"
+#include "uploader/system_profile_setter.h"
 
 namespace metrics {
 class ChromeUserMetricsExtension;
 }
 
 struct SystemProfile {
-  std::string os_name;
-  std::string os_version;
-  metrics::SystemProfileProto::Channel channel;
-  std::string app_version;
+  std::string version;
   std::string hardware_class;
   std::string client_id;
-  int32_t session_id;
-  int32_t product_id;
+  int session_id;
+  metrics::SystemProfileProto::Channel channel;
+  std::string build_target_id;
 };
 
 // Retrieves general system informations needed by the protobuf for context and
@@ -43,9 +40,9 @@
   SystemProfileCache(bool testing, const std::string& config_root);
 
   // Populates the ProfileSystem protobuf with system information.
-  void Populate(metrics::ChromeUserMetricsExtension* profile_proto) override;
+  void Populate(metrics::ChromeUserMetricsExtension* metrics_proto) override;
 
-  // Converts a string representation of the channel (|channel|-channel) to a
+  // Converts a string representation of the channel to a
   // SystemProfileProto_Channel
   static metrics::SystemProfileProto_Channel ProtoChannelFromString(
       const std::string& channel);
@@ -66,21 +63,6 @@
   // Initializes |profile_| only if it has not been yet initialized.
   bool InitializeOrCheck();
 
-  // Gets the hardware ID using crossystem
-  bool GetHardwareId(std::string* hwid);
-
-  // Gets the product ID from the GOOGLE_METRICS_PRODUCT_ID field.
-  bool GetProductId(int* product_id) const;
-
-  // Generate the formatted chromeos version from the fields in
-  // /etc/lsb-release. The format is A.B.C.D where A, B, C and D are positive
-  // integer representing:
-  // * the chrome milestone
-  // * the build number
-  // * the branch number
-  // * the patch number
-  bool GetChromeOSVersion(std::string* version);
-
   bool initialized_;
   bool testing_;
   std::string config_root_;
diff --git a/metrics/uploader/upload_service.cc b/metrics/uploader/upload_service.cc
index 92c9e10..3411004 100644
--- a/metrics/uploader/upload_service.cc
+++ b/metrics/uploader/upload_service.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "metrics/uploader/upload_service.h"
+#include "uploader/upload_service.h"
 
 #include <string>
 
@@ -17,11 +17,11 @@
 #include <base/metrics/statistics_recorder.h>
 #include <base/sha1.h>
 
-#include "metrics/serialization/metric_sample.h"
-#include "metrics/serialization/serialization_utils.h"
-#include "metrics/uploader/metrics_log.h"
-#include "metrics/uploader/sender_http.h"
-#include "metrics/uploader/system_profile_cache.h"
+#include "serialization/metric_sample.h"
+#include "serialization/serialization_utils.h"
+#include "uploader/metrics_log.h"
+#include "uploader/sender_http.h"
+#include "uploader/system_profile_setter.h"
 
 const int UploadService::kMaxFailedUpload = 10;
 
diff --git a/metrics/uploader/upload_service.h b/metrics/uploader/upload_service.h
index ebbb54f..c08fc1a 100644
--- a/metrics/uploader/upload_service.h
+++ b/metrics/uploader/upload_service.h
@@ -12,9 +12,9 @@
 #include "base/metrics/histogram_snapshot_manager.h"
 
 #include "metrics/metrics_library.h"
-#include "metrics/uploader/metrics_log.h"
-#include "metrics/uploader/sender.h"
-#include "metrics/uploader/system_profile_cache.h"
+#include "uploader/metrics_log.h"
+#include "uploader/sender.h"
+#include "uploader/system_profile_cache.h"
 
 namespace metrics {
 class ChromeUserMetricsExtension;
diff --git a/metrics/uploader/upload_service_test.cc b/metrics/uploader/upload_service_test.cc
index ee17e15..efd0a56 100644
--- a/metrics/uploader/upload_service_test.cc
+++ b/metrics/uploader/upload_service_test.cc
@@ -9,19 +9,16 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
 #include "base/sys_info.h"
-#include "metrics/metrics_library_mock.h"
-#include "metrics/serialization/metric_sample.h"
-#include "metrics/uploader/metrics_log.h"
-#include "metrics/uploader/mock/mock_system_profile_setter.h"
-#include "metrics/uploader/mock/sender_mock.h"
-#include "metrics/uploader/proto/chrome_user_metrics_extension.pb.h"
-#include "metrics/uploader/proto/histogram_event.pb.h"
-#include "metrics/uploader/proto/system_profile.pb.h"
-#include "metrics/uploader/system_profile_cache.h"
-#include "metrics/uploader/upload_service.h"
-
-static const char kMetricsServer[] = "https://clients4.google.com/uma/v2";
-static const char kMetricsFilePath[] = "/var/run/metrics/uma-events";
+#include "metrics_library_mock.h"
+#include "serialization/metric_sample.h"
+#include "uploader/metrics_log.h"
+#include "uploader/mock/mock_system_profile_setter.h"
+#include "uploader/mock/sender_mock.h"
+#include "uploader/proto/chrome_user_metrics_extension.pb.h"
+#include "uploader/proto/histogram_event.pb.h"
+#include "uploader/proto/system_profile.pb.h"
+#include "uploader/system_profile_cache.h"
+#include "uploader/upload_service.h"
 
 class UploadServiceTest : public testing::Test {
  protected: