OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/metrics_log.h" | 5 #include "components/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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 void InitPrefs() { | 67 void InitPrefs() { |
68 prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp, | 68 prefs_->SetString(prefs::kMetricsReportingEnabledTimestamp, |
69 base::Int64ToString(kEnabledDate)); | 69 base::Int64ToString(kEnabledDate)); |
70 } | 70 } |
71 | 71 |
72 virtual void GetFieldTrialIds( | 72 virtual void GetFieldTrialIds( |
73 std::vector<variations::ActiveGroupId>* field_trial_ids) const | 73 std::vector<variations::ActiveGroupId>* field_trial_ids) const |
74 OVERRIDE { | 74 override { |
75 ASSERT_TRUE(field_trial_ids->empty()); | 75 ASSERT_TRUE(field_trial_ids->empty()); |
76 | 76 |
77 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { | 77 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { |
78 field_trial_ids->push_back(kFieldTrialIds[i]); | 78 field_trial_ids->push_back(kFieldTrialIds[i]); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 // Weak pointer to the PrefsService used by this log. | 82 // Weak pointer to the PrefsService used by this log. |
83 TestingPrefServiceSimple* prefs_; | 83 TestingPrefServiceSimple* prefs_; |
84 | 84 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 TestMetricsServiceClient client; | 400 TestMetricsServiceClient client; |
401 client.set_product(kTestProduct); | 401 client.set_product(kTestProduct); |
402 TestMetricsLog log( | 402 TestMetricsLog log( |
403 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 403 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
404 // Check that the product is set to |kTestProduct|. | 404 // Check that the product is set to |kTestProduct|. |
405 EXPECT_TRUE(log.uma_proto().has_product()); | 405 EXPECT_TRUE(log.uma_proto().has_product()); |
406 EXPECT_EQ(kTestProduct, log.uma_proto().product()); | 406 EXPECT_EQ(kTestProduct, log.uma_proto().product()); |
407 } | 407 } |
408 | 408 |
409 } // namespace metrics | 409 } // namespace metrics |
OLD | NEW |