Flutter Engine
backtrace_unittests.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "backtrace.h"
6 
7 #include "gtest/gtest.h"
8 #include "logging.h"
9 
10 namespace fml {
11 namespace testing {
12 
13 TEST(BacktraceTest, CanGatherBacktrace) {
14  if (!IsCrashHandlingSupported()) {
15  GTEST_SKIP();
16  return;
17  }
18  {
19  auto trace = BacktraceHere(0);
20  ASSERT_GT(trace.size(), 0u);
21  ASSERT_NE(trace.find("Frame 0"), std::string::npos);
22  }
23 
24  {
25  auto trace = BacktraceHere(1);
26  ASSERT_GT(trace.size(), 0u);
27  ASSERT_NE(trace.find("Frame 0"), std::string::npos);
28  }
29 
30  {
31  auto trace = BacktraceHere(2);
32  ASSERT_GT(trace.size(), 0u);
33  ASSERT_NE(trace.find("Frame 0"), std::string::npos);
34  }
35 }
36 
37 } // namespace testing
38 } // namespace fml
bool IsCrashHandlingSupported()
Definition: backtrace.cc:143
std::string BacktraceHere(size_t offset)
Definition: backtrace.cc:57
Definition: ascii_trie.cc:9
TEST(BacktraceTest, CanGatherBacktrace)