| 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); |
| 32 } | 33 } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 int old_min_log_level_; | 36 int old_min_log_level_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); | 38 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 histogram->Add(3); | 721 histogram->Add(3); |
| 721 histogram->Add(5); | 722 histogram->Add(5); |
| 722 StatisticsRecorder::ImportProvidedHistograms(); | 723 StatisticsRecorder::ImportProvidedHistograms(); |
| 723 snapshot = found->SnapshotSamples(); | 724 snapshot = found->SnapshotSamples(); |
| 724 EXPECT_EQ(3, snapshot->TotalCount()); | 725 EXPECT_EQ(3, snapshot->TotalCount()); |
| 725 EXPECT_EQ(2, snapshot->GetCount(3)); | 726 EXPECT_EQ(2, snapshot->GetCount(3)); |
| 726 EXPECT_EQ(1, snapshot->GetCount(5)); | 727 EXPECT_EQ(1, snapshot->GetCount(5)); |
| 727 } | 728 } |
| 728 | 729 |
| 729 } // namespace base | 730 } // namespace base |
| OLD | NEW |