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 | #include "gtest/gtest.h" |
7 | #include "logging.h" |
8 | |
9 | namespace fml { |
10 | namespace testing { |
11 | |
12 | TEST(BacktraceTest, CanGatherBacktrace) { |
13 | if (!IsCrashHandlingSupported()) { |
14 | GTEST_SKIP(); |
15 | return; |
16 | } |
17 | { |
18 | auto trace = BacktraceHere(0); |
19 | ASSERT_GT(trace.size(), 0u); |
20 | ASSERT_NE(trace.find("Frame 0"), std::string::npos); |
21 | } |
22 | |
23 | { |
24 | auto trace = BacktraceHere(1); |
25 | ASSERT_GT(trace.size(), 0u); |
26 | ASSERT_NE(trace.find("Frame 0"), std::string::npos); |
27 | } |
28 | |
29 | { |
30 | auto trace = BacktraceHere(2); |
31 | ASSERT_GT(trace.size(), 0u); |
32 | ASSERT_NE(trace.find("Frame 0"), std::string::npos); |
33 | } |
34 | } |
35 | |
36 | } // namespace testing |
37 | } // namespace fml |
38 |