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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <string> | 10 #include <string> |
8 | 11 |
9 #include "base/base64.h" | 12 #include "base/base64.h" |
10 #include "base/basictypes.h" | 13 #include "base/macros.h" |
11 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
12 #include "base/metrics/bucket_ranges.h" | 15 #include "base/metrics/bucket_ranges.h" |
13 #include "base/metrics/sample_vector.h" | 16 #include "base/metrics/sample_vector.h" |
14 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
15 #include "base/prefs/testing_pref_service.h" | 18 #include "base/prefs/testing_pref_service.h" |
16 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
17 #include "base/time/time.h" | 20 #include "base/time/time.h" |
18 #include "components/metrics/metrics_pref_names.h" | 21 #include "components/metrics/metrics_pref_names.h" |
19 #include "components/metrics/metrics_state_manager.h" | 22 #include "components/metrics/metrics_state_manager.h" |
20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 23 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
21 #include "components/metrics/test_metrics_provider.h" | 24 #include "components/metrics/test_metrics_provider.h" |
22 #include "components/metrics/test_metrics_service_client.h" | 25 #include "components/metrics/test_metrics_service_client.h" |
23 #include "components/variations/active_field_trials.h" | 26 #include "components/variations/active_field_trials.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
25 | 28 |
26 namespace metrics { | 29 namespace metrics { |
27 | 30 |
28 namespace { | 31 namespace { |
29 | 32 |
30 const char kClientId[] = "bogus client ID"; | 33 const char kClientId[] = "bogus client ID"; |
31 const int64 kInstallDate = 1373051956; | 34 const int64_t kInstallDate = 1373051956; |
32 const int64 kInstallDateExpected = 1373050800; // Computed from kInstallDate. | 35 const int64_t kInstallDateExpected = 1373050800; // Computed from kInstallDate. |
33 const int64 kEnabledDate = 1373001211; | 36 const int64_t kEnabledDate = 1373001211; |
34 const int64 kEnabledDateExpected = 1373000400; // Computed from kEnabledDate. | 37 const int64_t kEnabledDateExpected = 1373000400; // Computed from kEnabledDate. |
35 const int kSessionId = 127; | 38 const int kSessionId = 127; |
36 const variations::ActiveGroupId kFieldTrialIds[] = { | 39 const variations::ActiveGroupId kFieldTrialIds[] = { |
37 {37, 43}, | 40 {37, 43}, |
38 {13, 47}, | 41 {13, 47}, |
39 {23, 17} | 42 {23, 17} |
40 }; | 43 }; |
41 const variations::ActiveGroupId kSyntheticTrials[] = { | 44 const variations::ActiveGroupId kSyntheticTrials[] = { |
42 {55, 15}, | 45 {55, 15}, |
43 {66, 16} | 46 {66, 16} |
44 }; | 47 }; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 TestMetricsServiceClient client; | 418 TestMetricsServiceClient client; |
416 client.set_product(kTestProduct); | 419 client.set_product(kTestProduct); |
417 TestMetricsLog log( | 420 TestMetricsLog log( |
418 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); | 421 kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, &prefs_); |
419 // Check that the product is set to |kTestProduct|. | 422 // Check that the product is set to |kTestProduct|. |
420 EXPECT_TRUE(log.uma_proto().has_product()); | 423 EXPECT_TRUE(log.uma_proto().has_product()); |
421 EXPECT_EQ(kTestProduct, log.uma_proto().product()); | 424 EXPECT_EQ(kTestProduct, log.uma_proto().product()); |
422 } | 425 } |
423 | 426 |
424 } // namespace metrics | 427 } // namespace metrics |
OLD | NEW |