blob: b1c678d1c6faf1409d66dcf3f00e92de508f4f48 [file] [log] [blame]
John Recke5da4ef2016-01-14 12:34:46 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "tests/common/TestUtils.h"
18
19#include <gtest/gtest.h>
John Reckf1dafb52016-01-15 16:57:26 -080020#include <cstdio>
John Recke5da4ef2016-01-14 12:34:46 -080021
22using namespace android::uirenderer;
23
24static void gunitCrashHandler() {
John Reckf1dafb52016-01-15 16:57:26 -080025 auto testinfo = ::testing::UnitTest::GetInstance()->current_test_info();
26 printf("[ FAILED ] %s.%s\n", testinfo->test_case_name(),
27 testinfo->name());
28 printf("[ FATAL! ] RenderThread crashed, aborting tests!\n");
29 fflush(stdout);
John Recke5da4ef2016-01-14 12:34:46 -080030}
31
32static void hookError() {
33 TestUtils::setRenderThreadCrashHandler(gunitCrashHandler);
34}
35
36class HookErrorInit {
37public:
38 HookErrorInit() { hookError(); }
39};
40
41static HookErrorInit sInit;