| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return *MetricsLog::uma_proto(); | 81 return *MetricsLog::uma_proto(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 const metrics::SystemProfileProto& system_profile() const { | 84 const metrics::SystemProfileProto& system_profile() const { |
| 85 return uma_proto().system_profile(); | 85 return uma_proto().system_profile(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 void InitPrefs() { | 89 void InitPrefs() { |
| 90 prefs_->SetInt64(prefs::kInstallDate, kInstallDate); | 90 prefs_->SetInt64(prefs::kInstallDate, kInstallDate); |
| 91 prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp, | 91 prefs_->SetString(metrics::prefs::kMetricsReportingEnabledTimestamp, |
| 92 base::Int64ToString(kEnabledDate)); | 92 base::Int64ToString(kEnabledDate)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual void GetFieldTrialIds( | 95 virtual void GetFieldTrialIds( |
| 96 std::vector<variations::ActiveGroupId>* field_trial_ids) const | 96 std::vector<variations::ActiveGroupId>* field_trial_ids) const |
| 97 OVERRIDE { | 97 OVERRIDE { |
| 98 ASSERT_TRUE(field_trial_ids->empty()); | 98 ASSERT_TRUE(field_trial_ids->empty()); |
| 99 | 99 |
| 100 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { | 100 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { |
| 101 field_trial_ids->push_back(kFieldTrialIds[i]); | 101 field_trial_ids->push_back(kFieldTrialIds[i]); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 tracked_object->process_type()); | 476 tracked_object->process_type()); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 TEST_F(MetricsLogTest, ChromeChannelWrittenToProtobuf) { | 480 TEST_F(MetricsLogTest, ChromeChannelWrittenToProtobuf) { |
| 481 metrics::TestMetricsServiceClient client; | 481 metrics::TestMetricsServiceClient client; |
| 482 TestMetricsLog log( | 482 TestMetricsLog log( |
| 483 "user@test.com", kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 483 "user@test.com", kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
| 484 EXPECT_TRUE(log.uma_proto().system_profile().has_channel()); | 484 EXPECT_TRUE(log.uma_proto().system_profile().has_channel()); |
| 485 } | 485 } |
| OLD | NEW |