Sends metrics to Chrome even when user did not consent to send stats.

BUG=chromium-os:21660
TEST=observed that Platform.* stats appear in about:histograms also when consent is turned off.

Change-Id: Id70f0cca468ec39fdfe687d89a6f0748a2a07828
Reviewed-on: http://gerrit.chromium.org/gerrit/10147
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index 707ea68..99e0deb 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -165,8 +165,6 @@
 }
 
 bool MetricsLibrary::SendMessageToChrome(int32_t length, const char* message) {
-  if (!AreMetricsEnabled())
-    return true;
 
   int chrome_fd = HANDLE_EINTR(open(uma_events_file_,
                                     O_WRONLY | O_APPEND | O_CREAT,
diff --git a/metrics/metrics_library_test.cc b/metrics/metrics_library_test.cc
index 0e58e01..3a5edcd 100644
--- a/metrics/metrics_library_test.cc
+++ b/metrics/metrics_library_test.cc
@@ -190,13 +190,6 @@
   EXPECT_EQ(0, memcmp(exp, buf, kLen));
 }
 
-TEST_F(MetricsLibraryTest, SendEnumToUMANotEnabled) {
-  EXPECT_CALL(*device_policy_, GetMetricsEnabled(_))
-      .WillOnce(SetMetricsPolicy(false));
-  EXPECT_TRUE(lib_.SendEnumToUMA("Test.EnumMetric", 1, 3));
-  EXPECT_FALSE(file_util::PathExists(kTestUMAEventsFile));
-}
-
 TEST_F(MetricsLibraryTest, SendMessageToChrome) {
   EXPECT_TRUE(lib_.SendMessageToChrome(4, "test"));
   EXPECT_TRUE(lib_.SendMessageToChrome(7, "content"));
@@ -226,13 +219,6 @@
   EXPECT_EQ(0, memcmp(exp, buf, kLen));
 }
 
-TEST_F(MetricsLibraryTest, SendToUMANotEnabled) {
-  EXPECT_CALL(*device_policy_, GetMetricsEnabled(_))
-      .WillOnce(SetMetricsPolicy(false));
-  EXPECT_TRUE(lib_.SendToUMA("Test.Metric", 2, 1, 100, 50));
-  EXPECT_FALSE(file_util::PathExists(kTestUMAEventsFile));
-}
-
 TEST_F(MetricsLibraryTest, SendUserActionToUMA) {
   char buf[100];
   const int kLen = 30;
@@ -244,14 +230,7 @@
   EXPECT_EQ(0, memcmp(exp, buf, kLen));
 }
 
-TEST_F(MetricsLibraryTest, SendUserActionToUMANotEnabled) {
-  EXPECT_CALL(*device_policy_, GetMetricsEnabled(_))
-      .WillOnce(SetMetricsPolicy(false));
-  EXPECT_TRUE(lib_.SendUserActionToUMA("SomeOtherKeyPressed"));
-  EXPECT_FALSE(file_util::PathExists(kTestUMAEventsFile));
-}
-
-TEST_F(MetricsLibraryTest, SendCrashToUMAEnabled) {
+TEST_F(MetricsLibraryTest, SendCrashToUMA) {
   EXPECT_TRUE(lib_.SendCrashToUMA("kernel"));
   char exp[100];
   int len = sprintf(exp, "%c%c%c%ccrash%ckernel",
@@ -262,13 +241,6 @@
   EXPECT_EQ(0, memcmp(exp, buf, len));
 }
 
-TEST_F(MetricsLibraryTest, SendCrashToUMANotEnabled) {
-  EXPECT_CALL(*device_policy_, GetMetricsEnabled(_))
-      .WillOnce(SetMetricsPolicy(false));
-  EXPECT_TRUE(lib_.SendCrashToUMA("kernel"));
-  EXPECT_FALSE(file_util::PathExists(kTestUMAEventsFile));
-}
-
 class CMetricsLibraryTest : public testing::Test {
  protected:
   virtual void SetUp() {