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/extension_metrics.h" | 5 #include "chrome/browser/metrics/extension_metrics.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/common/metrics/proto/system_profile.pb.h" | 9 #include "components/metrics/proto/system_profile.pb.h" |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
11 #include "extensions/common/extension_builder.h" | 11 #include "extensions/common/extension_builder.h" |
12 #include "extensions/common/extension_set.h" | 12 #include "extensions/common/extension_set.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class TestHashedExtensionMetrics : public HashedExtensionMetrics { | 17 class TestHashedExtensionMetrics : public HashedExtensionMetrics { |
18 public: | 18 public: |
19 explicit TestHashedExtensionMetrics(uint64 client_id) | 19 explicit TestHashedExtensionMetrics(uint64 client_id) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Checks that the fake set of extensions provided by | 76 // Checks that the fake set of extensions provided by |
77 // TestHashedExtensionMetrics is encoded properly. | 77 // TestHashedExtensionMetrics is encoded properly. |
78 TEST(HashedExtensionMetrics, SystemProtoEncoding) { | 78 TEST(HashedExtensionMetrics, SystemProtoEncoding) { |
79 metrics::SystemProfileProto system_profile; | 79 metrics::SystemProfileProto system_profile; |
80 TestHashedExtensionMetrics extension_metrics(0x3f1bfee9); | 80 TestHashedExtensionMetrics extension_metrics(0x3f1bfee9); |
81 extension_metrics.WriteExtensionList(&system_profile); | 81 extension_metrics.WriteExtensionList(&system_profile); |
82 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); | 82 ASSERT_EQ(2, system_profile.occupied_extension_bucket_size()); |
83 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); | 83 EXPECT_EQ(10, system_profile.occupied_extension_bucket(0)); |
84 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); | 84 EXPECT_EQ(1007, system_profile.occupied_extension_bucket(1)); |
85 } | 85 } |
OLD | NEW |