Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / metrics / metrics_service_unittest.cc
index 163be78..49c069c 100644 (file)
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/gfx/size.h"
 
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/metrics/metrics_log_chromeos.h"
+#endif  // OS_CHROMEOS
+
 namespace {
 
 class TestMetricsService : public MetricsService {
@@ -34,10 +38,30 @@ class TestMetricsService : public MetricsService {
   DISALLOW_COPY_AND_ASSIGN(TestMetricsService);
 };
 
+#if defined(OS_CHROMEOS)
+class TestMetricsLogChromeOS : public MetricsLogChromeOS {
+ public:
+  explicit TestMetricsLogChromeOS(
+      metrics::ChromeUserMetricsExtension* uma_proto)
+      : MetricsLogChromeOS(uma_proto) {
+  }
+
+ protected:
+  // Don't touch bluetooth information, as it won't be correctly initialized.
+  virtual void WriteBluetoothProto() OVERRIDE {
+  }
+};
+#endif  // OS_CHROMEOS
+
 class TestMetricsLog : public MetricsLog {
  public:
   TestMetricsLog(const std::string& client_id, int session_id)
-      : MetricsLog(client_id, session_id) {}
+      : MetricsLog(client_id, session_id) {
+#if defined(OS_CHROMEOS)
+    metrics_log_chromeos_.reset(new TestMetricsLogChromeOS(
+        MetricsLog::uma_proto()));
+#endif  // OS_CHROMEOS
+  }
   virtual ~TestMetricsLog() {}
 
  private:
@@ -53,10 +77,6 @@ class TestMetricsLog : public MetricsLog {
     return 1;
   }
 
-  virtual void WriteBluetoothProto(
-      metrics::SystemProfileProto::Hardware* hardware) OVERRIDE {
-  }
-
   DISALLOW_COPY_AND_ASSIGN(TestMetricsLog);
 };