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 "base/metrics/statistics_recorder.h" | 5 #include "base/metrics/statistics_recorder.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace { | 22 namespace { |
23 | 23 |
24 // Class to make sure any manipulations we do to the min log level are | 24 // Class to make sure any manipulations we do to the min log level are |
25 // contained (i.e., do not affect other unit tests). | 25 // contained (i.e., do not affect other unit tests). |
26 class LogStateSaver { | 26 class LogStateSaver { |
27 public: | 27 public: |
28 LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} | 28 LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} |
29 | 29 |
30 ~LogStateSaver() { | 30 ~LogStateSaver() { |
31 logging::SetMinLogLevel(old_min_log_level_); | 31 logging::SetMinLogLevel(old_min_log_level_); |
32 logging::SetLogAssertHandler(nullptr); | |
33 } | 32 } |
34 | 33 |
35 private: | 34 private: |
36 int old_min_log_level_; | 35 int old_min_log_level_; |
37 | 36 |
38 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); | 37 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); |
39 }; | 38 }; |
40 | 39 |
41 } // namespace | 40 } // namespace |
42 | 41 |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 histogram->Add(3); | 720 histogram->Add(3); |
722 histogram->Add(5); | 721 histogram->Add(5); |
723 StatisticsRecorder::ImportProvidedHistograms(); | 722 StatisticsRecorder::ImportProvidedHistograms(); |
724 snapshot = found->SnapshotSamples(); | 723 snapshot = found->SnapshotSamples(); |
725 EXPECT_EQ(3, snapshot->TotalCount()); | 724 EXPECT_EQ(3, snapshot->TotalCount()); |
726 EXPECT_EQ(2, snapshot->GetCount(3)); | 725 EXPECT_EQ(2, snapshot->GetCount(3)); |
727 EXPECT_EQ(1, snapshot->GetCount(5)); | 726 EXPECT_EQ(1, snapshot->GetCount(5)); |
728 } | 727 } |
729 | 728 |
730 } // namespace base | 729 } // namespace base |
OLD | NEW |