Commit 0870173a authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

DCHECK for proper usage in StackTraceGetter.

Code that uses GoogleTest assertions without using GoogleTest itself
will result in calls to CurrentStackTrace without a preceding call to
UponLeavingGTest. Make this easier to diagnose with a DCHECK.

BUG=1039559

Change-Id: Id80aa918f2197625ec4b1025a99d778aed46c1d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090413
Auto-Submit: Greg Thompson <grt@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747635}
parent 6d80454d
...@@ -7,7 +7,12 @@ ...@@ -7,7 +7,12 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include "base/logging.h"
std::string StackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) { std::string StackTraceGetter::CurrentStackTrace(int max_depth, int skip_count) {
DCHECK(stack_trace_upon_leaving_gtest_)
<< "Missing call to UponLeavingGTest. Are you using GoogleTest's "
"RUN_ALL_TESTS()?";
base::debug::StackTrace stack_trace; base::debug::StackTrace stack_trace;
size_t departure_frame_count = 0; size_t departure_frame_count = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment