| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ |
| 6 #define NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ | 6 #define NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 | |
| 16 // The ScopedDisableExitOnDFatal class is used to disable exiting the | 15 // The ScopedDisableExitOnDFatal class is used to disable exiting the |
| 17 // program when we encounter a LOG(DFATAL) within the current block. | 16 // program when we encounter a LOG(DFATAL) within the current block. |
| 18 // After we leave the current block, the default behavior is | 17 // After we leave the current block, the default behavior is |
| 19 // restored. | 18 // restored. |
| 20 class ScopedDisableExitOnDFatal { | 19 class ScopedDisableExitOnDFatal { |
| 21 public: | 20 public: |
| 22 ScopedDisableExitOnDFatal(); | 21 ScopedDisableExitOnDFatal(); |
| 23 ~ScopedDisableExitOnDFatal(); | 22 ~ScopedDisableExitOnDFatal(); |
| 24 | 23 |
| 25 private: | 24 private: |
| 26 // Currently active instance. | 25 // Currently active instance. |
| 27 static ScopedDisableExitOnDFatal* g_instance_; | 26 static ScopedDisableExitOnDFatal* g_instance_; |
| 28 | 27 |
| 29 // Static function which is set as the logging assert handler. | 28 // Static function which is set as the logging assert handler. |
| 30 // Called when there is a check failure. | 29 // Called when there is a check failure. |
| 31 static void LogAssertHandler(const std::string& msg); | 30 static void LogAssertHandler(const std::string& msg); |
| 32 | 31 |
| 33 DISALLOW_COPY_AND_ASSIGN(ScopedDisableExitOnDFatal); | 32 DISALLOW_COPY_AND_ASSIGN(ScopedDisableExitOnDFatal); |
| 34 }; | 33 }; |
| 35 | 34 |
| 36 } // namespace test | 35 } // namespace test |
| 37 } // namespace net | 36 } // namespace net |
| 38 | 37 |
| 39 #endif // NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ | 38 #endif // NET_QUIC_TEST_TOOLS_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ |
| OLD | NEW |