Commit 4488d712 authored by kelvinp@chromium.org's avatar kelvinp@chromium.org

Print callstack in _ASSERT_TRUE.

ASSERT_TRUE only prints the first call frame in the error message. In our case, this is the _ASSERT_TRUE wrapper function, which is not useful.

To help with debugging, this CL dumps the full stack.

Review URL: https://codereview.chromium.org/382193004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282737 0039d316-1c4b-4281-b951-d872f2087c98
parent c000352c
......@@ -5,6 +5,7 @@
#ifndef CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_
#define CHROME_TEST_REMOTING_REMOTE_DESKTOP_BROWSERTEST_H_
#include "base/debug/stack_trace.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
......@@ -30,6 +31,13 @@ const char kHttpServer[] = "http-server";
// ASSERT_TRUE can only be used in void returning functions. This version
// should be used in non-void-returning functions.
inline void _ASSERT_TRUE(bool condition) {
if (!condition) {
// ASSERT_TRUE only prints the first call frame in the error message.
// In our case, this is the _ASSERT_TRUE wrapper function, which is not
// useful. To help with debugging, we will dump the full callstack.
LOG(ERROR) << "Assertion failed.";
LOG(ERROR) << base::debug::StackTrace().ToString();
}
ASSERT_TRUE(condition);
return;
}
......
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