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 "chrome/browser/metrics/extensions_metrics_provider.h" | 5 #include "chrome/browser/metrics/extensions_metrics_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 EXPECT_EQ(10, | 96 EXPECT_EQ(10, |
97 TestExtensionsMetricsProvider::HashExtension( | 97 TestExtensionsMetricsProvider::HashExtension( |
98 "mdhofdjgenpkhlmddfaegdjddcecipmo", 3817)); | 98 "mdhofdjgenpkhlmddfaegdjddcecipmo", 3817)); |
99 } | 99 } |
100 | 100 |
101 // Checks that the fake set of extensions provided by | 101 // Checks that the fake set of extensions provided by |
102 // TestExtensionsMetricsProvider is encoded properly. | 102 // TestExtensionsMetricsProvider is encoded properly. |
103 TEST(ExtensionsMetricsProvider, SystemProtoEncoding) { | 103 TEST(ExtensionsMetricsProvider, SystemProtoEncoding) { |
104 metrics::SystemProfileProto system_profile; | 104 metrics::SystemProfileProto system_profile; |
105 TestingPrefServiceSimple local_state; | 105 TestingPrefServiceSimple local_state; |
106 MetricsService::RegisterPrefs(local_state.registry()); | 106 metrics::MetricsService::RegisterPrefs(local_state.registry()); |
107 scoped_ptr<metrics::MetricsStateManager> metrics_state_manager( | 107 scoped_ptr<metrics::MetricsStateManager> metrics_state_manager( |
108 metrics::MetricsStateManager::Create( | 108 metrics::MetricsStateManager::Create( |
109 &local_state, | 109 &local_state, |
110 base::Bind(&IsMetricsReportingEnabled), | 110 base::Bind(&IsMetricsReportingEnabled), |
111 base::Bind(&StoreNoClientInfoBackup), | 111 base::Bind(&StoreNoClientInfoBackup), |
112 base::Bind(&ReturnNoBackup))); | 112 base::Bind(&ReturnNoBackup))); |
113 TestExtensionsMetricsProvider extension_metrics(metrics_state_manager.get()); | 113 TestExtensionsMetricsProvider extension_metrics(metrics_state_manager.get()); |
114 extension_metrics.ProvideSystemProfileMetrics(&system_profile); | 114 extension_metrics.ProvideSystemProfileMetrics(&system_profile); |
115 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); | 115 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); |
116 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); | 116 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); |
117 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); | 117 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); |
118 } | 118 } |
OLD | NEW |