| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 extensions->Insert(extension); | 67 extensions->Insert(extension); |
| 68 extension = | 68 extension = |
| 69 extensions::ExtensionBuilder() | 69 extensions::ExtensionBuilder() |
| 70 .SetManifest(std::move(extensions::DictionaryBuilder() | 70 .SetManifest(std::move(extensions::DictionaryBuilder() |
| 71 .Set("name", "Colliding Extension") | 71 .Set("name", "Colliding Extension") |
| 72 .Set("version", "1.0.0") | 72 .Set("version", "1.0.0") |
| 73 .Set("manifest_version", 2))) | 73 .Set("manifest_version", 2))) |
| 74 .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") | 74 .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") |
| 75 .Build(); | 75 .Build(); |
| 76 extensions->Insert(extension); | 76 extensions->Insert(extension); |
| 77 return extensions.Pass(); | 77 return extensions; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Override GetClientID() to return a specific value on which test | 80 // Override GetClientID() to return a specific value on which test |
| 81 // expectations are based. | 81 // expectations are based. |
| 82 uint64_t GetClientID() override { return 0x3f1bfee9; } | 82 uint64_t GetClientID() override { return 0x3f1bfee9; } |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| 86 | 86 |
| 87 // Checks that the hash function used to hide precise extension IDs produces | 87 // Checks that the hash function used to hide precise extension IDs produces |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 &local_state, | 112 &local_state, |
| 113 base::Bind(&IsMetricsReportingEnabled), | 113 base::Bind(&IsMetricsReportingEnabled), |
| 114 base::Bind(&StoreNoClientInfoBackup), | 114 base::Bind(&StoreNoClientInfoBackup), |
| 115 base::Bind(&ReturnNoBackup))); | 115 base::Bind(&ReturnNoBackup))); |
| 116 TestExtensionsMetricsProvider extension_metrics(metrics_state_manager.get()); | 116 TestExtensionsMetricsProvider extension_metrics(metrics_state_manager.get()); |
| 117 extension_metrics.ProvideSystemProfileMetrics(&system_profile); | 117 extension_metrics.ProvideSystemProfileMetrics(&system_profile); |
| 118 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); | 118 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); |
| 119 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); | 119 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); |
| 120 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); | 120 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); |
| 121 } | 121 } |
| OLD | NEW |