Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: base/test/histogram_tester_unittest.cc

Issue 2451213003: Demonstrates example when GetTotalCountsForPrefix returns true for the suffix. (Closed)
Patch Set: Disables the test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/test/histogram_tester.h" 5 #include "base/test/histogram_tester.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/metrics/histogram_samples.h" 10 #include "base/metrics/histogram_samples.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using ::testing::ElementsAre; 14 using ::testing::ElementsAre;
15 using ::testing::IsEmpty; 15 using ::testing::IsEmpty;
16 16
17 namespace { 17 namespace {
18 18
19 const char kHistogram1[] = "Test1"; 19 const char kHistogram1[] = "Test1";
20 const char kHistogram2[] = "Test2"; 20 const char kHistogram2[] = "Test2";
21 const char kHistogram3[] = "Test3"; 21 const char kHistogram3[] = "Test3";
22 const char kHistogram4[] = "Test4"; 22 const char kHistogram4[] = "Test4";
23 const char kHistogram5[] = "Test5"; 23 const char kHistogram5[] = "Test5";
24 const char kHistogramSuffix[] = "Test4.Test5";
24 25
25 } // namespace 26 } // namespace
26 27
27 namespace base { 28 namespace base {
28 29
29 typedef testing::Test HistogramTesterTest; 30 typedef testing::Test HistogramTesterTest;
30 31
31 TEST_F(HistogramTesterTest, Scope) { 32 TEST_F(HistogramTesterTest, Scope) {
32 // Record a histogram before the creation of the recorder. 33 // Record a histogram before the creation of the recorder.
33 UMA_HISTOGRAM_BOOLEAN(kHistogram1, true); 34 UMA_HISTOGRAM_BOOLEAN(kHistogram1, true);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 EXPECT_THAT(tester.GetAllSamples(kHistogram5), 112 EXPECT_THAT(tester.GetAllSamples(kHistogram5),
112 ElementsAre(Bucket(2, 1), Bucket(3, 2), Bucket(5, 1))); 113 ElementsAre(Bucket(2, 1), Bucket(3, 2), Bucket(5, 1)));
113 } 114 }
114 115
115 TEST_F(HistogramTesterTest, TestGetAllSamples_NoSamples) { 116 TEST_F(HistogramTesterTest, TestGetAllSamples_NoSamples) {
116 HistogramTester tester; 117 HistogramTester tester;
117 EXPECT_THAT(tester.GetAllSamples(kHistogram5), IsEmpty()); 118 EXPECT_THAT(tester.GetAllSamples(kHistogram5), IsEmpty());
118 } 119 }
119 120
121 // Wrong behaviour for GetTotalCountForPrefix: https://crbug.com/659977
122 TEST_F(HistogramTesterTest, DISABLED_TestGetTotalCountsForPrefix) {
123 HistogramTester tester;
124 UMA_HISTOGRAM_ENUMERATION(kHistogramSuffix, 2, 5);
Paweł Hajdan Jr. 2016/10/27 16:55:51 nit: Is it worth extracting this as a constant? In
melandory 2016/10/28 07:30:15 Funnily, in-lining Test4.Test5 triggers the presub
125
126 EXPECT_TRUE(tester.GetTotalCountsForPrefix("Test5").empty());
127 }
128
120 } // namespace base 129 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698