| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <sstream> | 5 #include <sstream> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 namespace debug { | 13 namespace debug { |
| 14 | 14 |
| 15 // Note: On Linux, this test currently only fully works on Debug builds. | 15 // Note: On Linux, this test currently only fully works on Debug builds. |
| 16 // See comments in the #ifdef soup if you intend to change this. | 16 // See comments in the #ifdef soup if you intend to change this. |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 // Always fails on Windows: crbug.com/32070 | 18 // Always fails on Windows: crbug.com/32070 |
| 19 #define MAYBE_OutputToStream FAILS_OutputToStream | 19 #define MAYBE_OutputToStream DISABLED_OutputToStream |
| 20 #else | 20 #else |
| 21 #define MAYBE_OutputToStream OutputToStream | 21 #define MAYBE_OutputToStream OutputToStream |
| 22 #endif | 22 #endif |
| 23 TEST(StackTrace, MAYBE_OutputToStream) { | 23 TEST(StackTrace, MAYBE_OutputToStream) { |
| 24 StackTrace trace; | 24 StackTrace trace; |
| 25 | 25 |
| 26 // Dump the trace into a string. | 26 // Dump the trace into a string. |
| 27 std::ostringstream os; | 27 std::ostringstream os; |
| 28 trace.OutputToStream(&os); | 28 trace.OutputToStream(&os); |
| 29 std::string backtrace_message = os.str(); | 29 std::string backtrace_message = os.str(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 VLOG(1) << os.str(); | 111 VLOG(1) << os.str(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // The test is used for manual testing, e.g., to see the raw output. | 114 // The test is used for manual testing, e.g., to see the raw output. |
| 115 TEST(StackTrace, DebugPrintBacktrace) { | 115 TEST(StackTrace, DebugPrintBacktrace) { |
| 116 StackTrace().PrintBacktrace(); | 116 StackTrace().PrintBacktrace(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace debug | 119 } // namespace debug |
| 120 } // namespace base | 120 } // namespace base |
| OLD | NEW |