Move initTraceEvent to WebView code in Android tree to avoid reflection.
[chromium-blink-merge.git] / base / test / statistics_delta_reader_unittest.cc
blob55180d115d1fd22ca1ce07192b3fc6004f35e456
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
3 // found in the LICENSE file.
5 #include "base/test/statistics_delta_reader.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_samples.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace base {
14 TEST(StatisticsDeltaReaderTest, Scope) {
15 // Record a histogram before the creation of the recorder.
16 UMA_HISTOGRAM_BOOLEAN("Test", true);
18 StatisticsDeltaReader reader;
20 // Verify that no histogram is recorded.
21 scoped_ptr<HistogramSamples> samples(
22 reader.GetHistogramSamplesSinceCreation("Test"));
23 EXPECT_FALSE(samples);
25 // Record a histogram after the creation of the recorder.
26 UMA_HISTOGRAM_BOOLEAN("Test", true);
28 // Verify that one histogram is recorded.
29 samples = reader.GetHistogramSamplesSinceCreation("Test");
30 EXPECT_TRUE(samples);
31 EXPECT_EQ(1, samples->TotalCount());
34 } // namespace base