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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « base/metrics/histogram_delta_serialization.h ('k') | base/metrics/histogram_samples.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/metrics/histogram_delta_serialization.h" 5 #include "base/metrics/histogram_delta_serialization.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/histogram_base.h" 10 #include "base/metrics/histogram_base.h"
(...skipping 16 matching lines...) Expand all
27 histogram->Add(10); 27 histogram->Add(10);
28 histogram->Add(100); 28 histogram->Add(100);
29 histogram->Add(1000); 29 histogram->Add(1000);
30 30
31 serializer.PrepareAndSerializeDeltas(&deltas, true); 31 serializer.PrepareAndSerializeDeltas(&deltas, true);
32 EXPECT_FALSE(deltas.empty()); 32 EXPECT_FALSE(deltas.empty());
33 33
34 HistogramDeltaSerialization::DeserializeAndAddSamples(deltas); 34 HistogramDeltaSerialization::DeserializeAndAddSamples(deltas);
35 35
36 // The histogram has kIPCSerializationSourceFlag. So samples will be ignored. 36 // The histogram has kIPCSerializationSourceFlag. So samples will be ignored.
37 scoped_ptr<HistogramSamples> snapshot(histogram->SnapshotSamples()); 37 std::unique_ptr<HistogramSamples> snapshot(histogram->SnapshotSamples());
38 EXPECT_EQ(1, snapshot->GetCount(1)); 38 EXPECT_EQ(1, snapshot->GetCount(1));
39 EXPECT_EQ(1, snapshot->GetCount(10)); 39 EXPECT_EQ(1, snapshot->GetCount(10));
40 EXPECT_EQ(1, snapshot->GetCount(100)); 40 EXPECT_EQ(1, snapshot->GetCount(100));
41 EXPECT_EQ(1, snapshot->GetCount(1000)); 41 EXPECT_EQ(1, snapshot->GetCount(1000));
42 42
43 // Clear kIPCSerializationSourceFlag to emulate multi-process usage. 43 // Clear kIPCSerializationSourceFlag to emulate multi-process usage.
44 histogram->ClearFlags(HistogramBase::kIPCSerializationSourceFlag); 44 histogram->ClearFlags(HistogramBase::kIPCSerializationSourceFlag);
45 HistogramDeltaSerialization::DeserializeAndAddSamples(deltas); 45 HistogramDeltaSerialization::DeserializeAndAddSamples(deltas);
46 46
47 scoped_ptr<HistogramSamples> snapshot2(histogram->SnapshotSamples()); 47 std::unique_ptr<HistogramSamples> snapshot2(histogram->SnapshotSamples());
48 EXPECT_EQ(2, snapshot2->GetCount(1)); 48 EXPECT_EQ(2, snapshot2->GetCount(1));
49 EXPECT_EQ(2, snapshot2->GetCount(10)); 49 EXPECT_EQ(2, snapshot2->GetCount(10));
50 EXPECT_EQ(2, snapshot2->GetCount(100)); 50 EXPECT_EQ(2, snapshot2->GetCount(100));
51 EXPECT_EQ(2, snapshot2->GetCount(1000)); 51 EXPECT_EQ(2, snapshot2->GetCount(1000));
52 } 52 }
53 53
54 } // namespace base 54 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_delta_serialization.h ('k') | base/metrics/histogram_samples.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698