Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: net/test/scoped_disable_exit_on_dfatal.cc

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Add test for assert handlers nesting. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/test/scoped_disable_exit_on_dfatal.h ('k') | net/tools/stress_cache/stress_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "net/test/scoped_disable_exit_on_dfatal.h" 5 #include "net/test/scoped_disable_exit_on_dfatal.h"
6 6
7 #include "base/bind.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_piece.h"
8 10
9 namespace net { 11 namespace net {
10 namespace test { 12 namespace test {
11 13
12 // static 14 ScopedDisableExitOnDFatal::ScopedDisableExitOnDFatal()
13 ScopedDisableExitOnDFatal* ScopedDisableExitOnDFatal::g_instance_ = NULL; 15 : assert_handler_(base::Bind(LogAssertHandler)) {}
14 16
15 ScopedDisableExitOnDFatal::ScopedDisableExitOnDFatal() { 17 ScopedDisableExitOnDFatal::~ScopedDisableExitOnDFatal() {}
16 CHECK(!g_instance_);
17 g_instance_ = this;
18 logging::SetLogAssertHandler(LogAssertHandler);
19 }
20
21 ScopedDisableExitOnDFatal::~ScopedDisableExitOnDFatal() {
22 CHECK_EQ(g_instance_, this);
23 logging::SetLogAssertHandler(NULL);
24 g_instance_ = NULL;
25 }
26 18
27 // static 19 // static
28 void ScopedDisableExitOnDFatal::LogAssertHandler(const std::string& str) { 20 void ScopedDisableExitOnDFatal::LogAssertHandler(
21 const char* file,
22 int line,
23 const base::StringPiece message,
24 const base::StringPiece stack_trace) {
29 // Simply swallow the assert. 25 // Simply swallow the assert.
30 } 26 }
31 27
32 } // namespace test 28 } // namespace test
33 } // namespace net 29 } // namespace net
OLDNEW
« no previous file with comments | « net/test/scoped_disable_exit_on_dfatal.h ('k') | net/tools/stress_cache/stress_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698