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 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Class to make sure any manipulations we do to the min log level are | 23 // Class to make sure any manipulations we do to the min log level are |
24 // contained (i.e., do not affect other unit tests). | 24 // contained (i.e., do not affect other unit tests). |
25 class LogStateSaver { | 25 class LogStateSaver { |
26 public: | 26 public: |
27 LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} | 27 LogStateSaver() : old_min_log_level_(logging::GetMinLogLevel()) {} |
28 | 28 |
29 ~LogStateSaver() { | 29 ~LogStateSaver() { |
30 logging::SetMinLogLevel(old_min_log_level_); | 30 logging::SetMinLogLevel(old_min_log_level_); |
31 logging::SetLogAssertHandler(nullptr); | |
32 } | 31 } |
33 | 32 |
34 private: | 33 private: |
35 int old_min_log_level_; | 34 int old_min_log_level_; |
36 | 35 |
37 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); | 36 DISALLOW_COPY_AND_ASSIGN(LogStateSaver); |
38 }; | 37 }; |
39 | 38 |
40 } // namespace | 39 } // namespace |
41 | 40 |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 649 |
651 TEST_P(StatisticsRecorderTest, LogOnShutdownInitialized) { | 650 TEST_P(StatisticsRecorderTest, LogOnShutdownInitialized) { |
652 UninitializeStatisticsRecorder(); | 651 UninitializeStatisticsRecorder(); |
653 logging::SetMinLogLevel(logging::LOG_VERBOSE); | 652 logging::SetMinLogLevel(logging::LOG_VERBOSE); |
654 InitializeStatisticsRecorder(); | 653 InitializeStatisticsRecorder(); |
655 EXPECT_TRUE(VLOG_IS_ON(1)); | 654 EXPECT_TRUE(VLOG_IS_ON(1)); |
656 EXPECT_TRUE(VLogInitialized()); | 655 EXPECT_TRUE(VLogInitialized()); |
657 } | 656 } |
658 | 657 |
659 } // namespace base | 658 } // namespace base |
OLD | NEW |