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

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

Issue 379283002: Rework UMAHistogramHelper and StatisticsDeltaReader into [Chrome]HistogramTester. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prefer base histogram_tester. ChromeHistogramTester with RunMessageLoop for NaCl Created 6 years, 5 months 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 | Annotate | Revision Log
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/statistics_delta_reader.h" 5 #include "base/test/histogram_tester.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_samples.h" 9 #include "base/metrics/histogram_samples.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 TEST(StatisticsDeltaReaderTest, Scope) { 14 TEST(HistogramTesterTest, Scope) {
15 // Record a histogram before the creation of the recorder. 15 // Record a histogram before the creation of the recorder.
16 UMA_HISTOGRAM_BOOLEAN("Test", true); 16 UMA_HISTOGRAM_BOOLEAN("Test", true);
17 17
18 StatisticsDeltaReader reader; 18 HistogramTester tester;
19 19
20 // Verify that no histogram is recorded. 20 // Verify that no histogram is recorded.
21 scoped_ptr<HistogramSamples> samples( 21 scoped_ptr<HistogramSamples> samples(
22 reader.GetHistogramSamplesSinceCreation("Test")); 22 tester.GetBaseHistogramSamples("Test"));
23 EXPECT_FALSE(samples); 23 EXPECT_FALSE(samples);
24 24
25 // Record a histogram after the creation of the recorder. 25 // Record a histogram after the creation of the recorder.
26 UMA_HISTOGRAM_BOOLEAN("Test", true); 26 UMA_HISTOGRAM_BOOLEAN("Test", true);
27 27
28 // Verify that one histogram is recorded. 28 // Verify that one histogram is recorded.
29 samples = reader.GetHistogramSamplesSinceCreation("Test"); 29 samples = tester.GetBaseHistogramSamples("Test");
30 EXPECT_TRUE(samples); 30 EXPECT_TRUE(samples);
31 EXPECT_EQ(1, samples->TotalCount()); 31 EXPECT_EQ(1, samples->TotalCount());
32 } 32 }
Ilya Sherman 2014/07/15 03:56:35 Please add test coverage for the other methods in
Mike Lerman 2014/07/16 17:29:03 Done. I can add tests that will succeed, (e.g. log
33 33
34 } // namespace base 34 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698