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

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

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Add comment. Fix missed usage of SetLogAssertHandler. Created 3 years, 10 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
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 #ifndef NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ 5 #ifndef NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_
6 #define NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ 6 #define NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/logging_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace net { 14 namespace net {
14 namespace test { 15 namespace test {
15 16
16 // The ScopedDisableExitOnDFatal class is used to disable exiting the 17 // The ScopedDisableExitOnDFatal class is used to disable exiting the
17 // program when we encounter a LOG(DFATAL) within the current block. 18 // program when we encounter a LOG(DFATAL) within the current block.
18 // After we leave the current block, the default behavior is 19 // After we leave the current block, the default behavior is
19 // restored. 20 // restored.
20 class ScopedDisableExitOnDFatal { 21 class ScopedDisableExitOnDFatal : public logging::ScopedLogAssertHandler {
Paweł Hajdan Jr. 2017/01/27 17:19:44 Should we use composition instead of inheritance?
alex-ac 2017/02/11 20:12:20 Done.
21 public: 22 public:
22 ScopedDisableExitOnDFatal(); 23 ScopedDisableExitOnDFatal();
23 ~ScopedDisableExitOnDFatal(); 24 ~ScopedDisableExitOnDFatal();
24 25
25 private: 26 private:
26 // Currently active instance.
27 static ScopedDisableExitOnDFatal* g_instance_;
28
29 // Static function which is set as the logging assert handler. 27 // Static function which is set as the logging assert handler.
30 // Called when there is a check failure. 28 // Called when there is a check failure.
31 static void LogAssertHandler(const std::string& msg); 29 static void LogAssertHandler(const char* file,
30 int line,
31 size_t message_start,
32 size_t stack_start,
33 const std::string& msg);
32 34
33 DISALLOW_COPY_AND_ASSIGN(ScopedDisableExitOnDFatal); 35 DISALLOW_COPY_AND_ASSIGN(ScopedDisableExitOnDFatal);
34 }; 36 };
35 37
36 } // namespace test 38 } // namespace test
37 } // namespace net 39 } // namespace net
38 40
39 #endif // NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_ 41 #endif // NET_TEST_SCOPED_DISABLE_EXIT_ON_DFATAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698