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

Side by Side Diff: base/metrics/histogram_base_unittest.cc

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/metrics/histogram_flattener.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/histogram_base.h" 8 #include "base/metrics/histogram_base.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 PickleIterator iter2(pickle); 161 PickleIterator iter2(pickle);
162 deserialized = DeserializeHistogramInfo(&iter2); 162 deserialized = DeserializeHistogramInfo(&iter2);
163 EXPECT_TRUE(deserialized); 163 EXPECT_TRUE(deserialized);
164 EXPECT_NE(histogram, deserialized); 164 EXPECT_NE(histogram, deserialized);
165 EXPECT_EQ("TestHistogram", deserialized->histogram_name()); 165 EXPECT_EQ("TestHistogram", deserialized->histogram_name());
166 EXPECT_TRUE(deserialized->HasConstructionArguments(5, 13, 4)); 166 EXPECT_TRUE(deserialized->HasConstructionArguments(5, 13, 4));
167 EXPECT_EQ(0, deserialized->flags()); 167 EXPECT_EQ(0, deserialized->flags());
168 } 168 }
169 169
170 // TODO(kaiwang): Add SparseHistogram test. 170 TEST_F(HistogramBaseTest, DeserializeSparseHistogram) {
171 HistogramBase* histogram = SparseHistogram::FactoryGet(
172 "TestHistogram", HistogramBase::kIPCSerializationSourceFlag);
173
174 Pickle pickle;
175 ASSERT_TRUE(histogram->SerializeInfo(&pickle));
176
177 PickleIterator iter(pickle);
178 HistogramBase* deserialized = DeserializeHistogramInfo(&iter);
179 EXPECT_EQ(histogram, deserialized);
180
181 ResetStatisticsRecorder();
182
183 PickleIterator iter2(pickle);
184 deserialized = DeserializeHistogramInfo(&iter2);
185 EXPECT_TRUE(deserialized);
186 EXPECT_NE(histogram, deserialized);
187 EXPECT_EQ("TestHistogram", deserialized->histogram_name());
188 EXPECT_EQ(0, deserialized->flags());
189 }
171 190
172 } // namespace base 191 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/metrics/histogram_flattener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698