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
3 // found in the LICENSE file.
5 #ifndef NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_
6 #define NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_
8 #include "base/logging.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
16 // The ScopedDisableExitOnDFatal class is used to disable exiting the
17 // program when we encounter a LOG(DFATAL) within the current block.
18 // After we leave the current block, the default behavior is
20 class ScopedDisableExitOnDFatal
{
22 ScopedDisableExitOnDFatal();
23 ~ScopedDisableExitOnDFatal();
26 // Currently active instance.
27 static ScopedDisableExitOnDFatal
* g_instance_
;
29 // Static function which is set as the logging assert handler.
30 // Called when there is a check failure.
31 static void LogAssertHandler(const std::string
& msg
);
33 DISALLOW_COPY_AND_ASSIGN(ScopedDisableExitOnDFatal
);
39 #endif // NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_