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