OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Get this first so it never gets created in persistent storage and will | 24 // Get this first so it never gets created in persistent storage and will |
25 // not appear in the StatisticsRecorder after it is re-initialized. | 25 // not appear in the StatisticsRecorder after it is re-initialized. |
26 GetCreateHistogramResultHistogram(); | 26 GetCreateHistogramResultHistogram(); |
27 // Each test will have a clean state (no Histogram / BucketRanges | 27 // Each test will have a clean state (no Histogram / BucketRanges |
28 // registered). | 28 // registered). |
29 InitializeStatisticsRecorder(); | 29 InitializeStatisticsRecorder(); |
30 } | 30 } |
31 | 31 |
32 void TearDown() override { | 32 void TearDown() override { |
33 UninitializeStatisticsRecorder(); | 33 UninitializeStatisticsRecorder(); |
34 SetPersistentHistogramMemoryAllocator(nullptr); | 34 delete ReleasePersistentHistogramMemoryAllocatorForTesting(); |
35 } | 35 } |
36 | 36 |
37 void InitializeStatisticsRecorder() { | 37 void InitializeStatisticsRecorder() { |
38 statistics_recorder_ = new StatisticsRecorder(); | 38 statistics_recorder_ = new StatisticsRecorder(); |
39 } | 39 } |
40 | 40 |
41 void UninitializeStatisticsRecorder() { | 41 void UninitializeStatisticsRecorder() { |
42 delete statistics_recorder_; | 42 delete statistics_recorder_; |
43 statistics_recorder_ = NULL; | 43 statistics_recorder_ = NULL; |
44 } | 44 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 HistogramBase* histogram = Histogram::FactoryGet("TestHistogram", 1, 1000, 10, | 507 HistogramBase* histogram = Histogram::FactoryGet("TestHistogram", 1, 1000, 10, |
508 HistogramBase::kNoFlags); | 508 HistogramBase::kNoFlags); |
509 EXPECT_TRUE(histogram); | 509 EXPECT_TRUE(histogram); |
510 histogram->Add(1); | 510 histogram->Add(1); |
511 | 511 |
512 EXPECT_TRUE(callback_wrapper.called); | 512 EXPECT_TRUE(callback_wrapper.called); |
513 EXPECT_EQ(callback_wrapper.last_histogram_value, 1); | 513 EXPECT_EQ(callback_wrapper.last_histogram_value, 1); |
514 } | 514 } |
515 | 515 |
516 } // namespace base | 516 } // namespace base |
OLD | NEW |