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.
4
5#include "net/test/scoped_disable_exit_on_dfatal.h"
6
7#include "base/logging.h"
8
9namespace net {
10namespace test {
11
12// static
13ScopedDisableExitOnDFatal* ScopedDisableExitOnDFatal::g_instance_ = NULL;
14
15ScopedDisableExitOnDFatal::ScopedDisableExitOnDFatal() {
16  CHECK(!g_instance_);
17  g_instance_ = this;
18  logging::SetLogAssertHandler(LogAssertHandler);
19}
20
21ScopedDisableExitOnDFatal::~ScopedDisableExitOnDFatal() {
22  CHECK_EQ(g_instance_, this);
23  logging::SetLogAssertHandler(NULL);
24  g_instance_ = NULL;
25}
26
27// static
28void ScopedDisableExitOnDFatal::LogAssertHandler(const std::string& str) {
29  // Simply swallow the assert.
30}
31
32}  // namespace test
33}  // namespace net
34