| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/metrics/histogram_macros.h" | 6 #include "base/metrics/histogram_macros.h" |
| 7 #include "base/test/histogram_tester.h" | 7 #include "base/test/histogram_tester.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/media/router/media_router_metrics.h" | 9 #include "chrome/browser/media/router/media_router_metrics.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 MediaRouterMetrics::RecordRouteCreationOutcome(outcome1); | 86 MediaRouterMetrics::RecordRouteCreationOutcome(outcome1); |
| 87 MediaRouterMetrics::RecordRouteCreationOutcome(outcome2); | 87 MediaRouterMetrics::RecordRouteCreationOutcome(outcome2); |
| 88 tester.ExpectTotalCount(MediaRouterMetrics::kHistogramRouteCreationOutcome, | 88 tester.ExpectTotalCount(MediaRouterMetrics::kHistogramRouteCreationOutcome, |
| 89 3); | 89 3); |
| 90 EXPECT_THAT( | 90 EXPECT_THAT( |
| 91 tester.GetAllSamples(MediaRouterMetrics::kHistogramRouteCreationOutcome), | 91 tester.GetAllSamples(MediaRouterMetrics::kHistogramRouteCreationOutcome), |
| 92 ElementsAre(Bucket(static_cast<int>(outcome1), 1), | 92 ElementsAre(Bucket(static_cast<int>(outcome1), 1), |
| 93 Bucket(static_cast<int>(outcome2), 2))); | 93 Bucket(static_cast<int>(outcome2), 2))); |
| 94 } | 94 } |
| 95 | 95 |
| 96 TEST(MediaRouterMetricsTest, RecordDialDeviceCounts) { |
| 97 base::HistogramTester tester; |
| 98 tester.ExpectTotalCount(MediaRouterMetrics::kDialAvailableDeviceCount, 0); |
| 99 tester.ExpectTotalCount(MediaRouterMetrics::kDialKnownDeviceCount, 0); |
| 100 |
| 101 MediaRouterMetrics::RecordDialDeviceCounts(6, 10); |
| 102 MediaRouterMetrics::RecordDialDeviceCounts(7, 10); |
| 103 |
| 104 tester.ExpectTotalCount(MediaRouterMetrics::kDialAvailableDeviceCount, 2); |
| 105 tester.ExpectTotalCount(MediaRouterMetrics::kDialKnownDeviceCount, 2); |
| 106 tester.ExpectBucketCount(MediaRouterMetrics::kDialAvailableDeviceCount, 6, 1); |
| 107 tester.ExpectBucketCount(MediaRouterMetrics::kDialAvailableDeviceCount, 7, 1); |
| 108 tester.ExpectBucketCount(MediaRouterMetrics::kDialKnownDeviceCount, 10, 2); |
| 109 } |
| 110 |
| 96 } // namespace media_router | 111 } // namespace media_router |
| OLD | NEW |