| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 | 88 |
| 89 class MetricsLogTest : public testing::Test { | 89 class MetricsLogTest : public testing::Test { |
| 90 public: | 90 public: |
| 91 MetricsLogTest() { | 91 MetricsLogTest() { |
| 92 MetricsLog::RegisterPrefs(prefs_.registry()); | 92 MetricsLog::RegisterPrefs(prefs_.registry()); |
| 93 MetricsStateManager::RegisterPrefs(prefs_.registry()); | 93 MetricsStateManager::RegisterPrefs(prefs_.registry()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 virtual ~MetricsLogTest() { | 96 ~MetricsLogTest() override {} |
| 97 } | |
| 98 | 97 |
| 99 protected: | 98 protected: |
| 100 // Check that the values in |system_values| correspond to the test data | 99 // Check that the values in |system_values| correspond to the test data |
| 101 // defined at the top of this file. | 100 // defined at the top of this file. |
| 102 void CheckSystemProfile(const SystemProfileProto& system_profile) { | 101 void CheckSystemProfile(const SystemProfileProto& system_profile) { |
| 103 EXPECT_EQ(kInstallDateExpected, system_profile.install_date()); | 102 EXPECT_EQ(kInstallDateExpected, system_profile.install_date()); |
| 104 EXPECT_EQ(kEnabledDateExpected, system_profile.uma_enabled_date()); | 103 EXPECT_EQ(kEnabledDateExpected, system_profile.uma_enabled_date()); |
| 105 | 104 |
| 106 ASSERT_EQ(arraysize(kFieldTrialIds) + arraysize(kSyntheticTrials), | 105 ASSERT_EQ(arraysize(kFieldTrialIds) + arraysize(kSyntheticTrials), |
| 107 static_cast<size_t>(system_profile.field_trial_size())); | 106 static_cast<size_t>(system_profile.field_trial_size())); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 TestMetricsServiceClient client; | 398 TestMetricsServiceClient client; |
| 400 client.set_product(kTestProduct); | 399 client.set_product(kTestProduct); |
| 401 TestMetricsLog log( | 400 TestMetricsLog log( |
| 402 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 401 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
| 403 // Check that the product is set to |kTestProduct|. | 402 // Check that the product is set to |kTestProduct|. |
| 404 EXPECT_TRUE(log.uma_proto().has_product()); | 403 EXPECT_TRUE(log.uma_proto().has_product()); |
| 405 EXPECT_EQ(kTestProduct, log.uma_proto().product()); | 404 EXPECT_EQ(kTestProduct, log.uma_proto().product()); |
| 406 } | 405 } |
| 407 | 406 |
| 408 } // namespace metrics | 407 } // namespace metrics |
| OLD | NEW |