xref: /aosp_15_r20/external/cronet/net/test/scoped_disable_exit_on_dfatal.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "net/test/scoped_disable_exit_on_dfatal.h"
6 
7 #include <string_view>
8 
9 #include "base/functional/bind.h"
10 #include "base/functional/callback.h"
11 #include "base/strings/string_piece.h"
12 
13 namespace net::test {
14 
ScopedDisableExitOnDFatal()15 ScopedDisableExitOnDFatal::ScopedDisableExitOnDFatal()
16     : assert_handler_(base::BindRepeating(LogAssertHandler)) {}
17 
18 ScopedDisableExitOnDFatal::~ScopedDisableExitOnDFatal() = default;
19 
20 // static
LogAssertHandler(const char * file,int line,const std::string_view message,const std::string_view stack_trace)21 void ScopedDisableExitOnDFatal::LogAssertHandler(
22     const char* file,
23     int line,
24     const std::string_view message,
25     const std::string_view stack_trace) {
26   // Simply swallow the assert.
27 }
28 
29 }  // namespace net::test
30