OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.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 { |
| 13 namespace debug { |
| 14 |
12 // 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. |
13 // 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. |
14 // Flaky, crbug.com/32070. | 17 // Flaky, crbug.com/32070. |
15 TEST(StackTrace, FLAKY_OutputToStream) { | 18 TEST(StackTrace, FLAKY_OutputToStream) { |
16 StackTrace trace; | 19 StackTrace trace; |
17 | 20 |
18 // Dump the trace into a string. | 21 // Dump the trace into a string. |
19 std::ostringstream os; | 22 std::ostringstream os; |
20 trace.OutputToStream(&os); | 23 trace.OutputToStream(&os); |
21 std::string backtrace_message = os.str(); | 24 std::string backtrace_message = os.str(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 << backtrace_message; | 93 << backtrace_message; |
91 | 94 |
92 #endif // define(OS_MACOSX) | 95 #endif // define(OS_MACOSX) |
93 } | 96 } |
94 | 97 |
95 // The test is used for manual testing, e.g., to see the raw output. | 98 // The test is used for manual testing, e.g., to see the raw output. |
96 TEST(StackTrace, DebugOutputToStream) { | 99 TEST(StackTrace, DebugOutputToStream) { |
97 StackTrace trace; | 100 StackTrace trace; |
98 std::ostringstream os; | 101 std::ostringstream os; |
99 trace.OutputToStream(&os); | 102 trace.OutputToStream(&os); |
100 LOG(INFO) << os.str(); | 103 VLOG(1) << os.str(); |
101 } | 104 } |
102 | 105 |
103 // The test is used for manual testing, e.g., to see the raw output. | 106 // The test is used for manual testing, e.g., to see the raw output. |
104 TEST(StackTrace, DebugPrintBacktrace) { | 107 TEST(StackTrace, DebugPrintBacktrace) { |
105 StackTrace().PrintBacktrace(); | 108 StackTrace().PrintBacktrace(); |
106 } | 109 } |
| 110 |
| 111 } // namespace debug |
| 112 } // namespace base |
OLD | NEW |