xref: /aosp_15_r20/external/cronet/testing/android/native_test/native_browser_test_support.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // This class sets up the environment for running the native tests inside an
6 // android application. It outputs (to a fifo) markers identifying the
7 // START/PASSED/CRASH of the test suite, FAILURE/SUCCESS of individual tests,
8 // etc.
9 // These markers are read by the test runner script to generate test results.
10 // It installs signal handlers to detect crashes.
11 
12 #include "testing/android/native_test/native_browser_test_jni/NativeBrowserTest_jni.h"
13 
14 namespace testing {
15 namespace android {
16 
17 namespace {
18 
19 // Java calls to set this true when async startup tasks are done for browser
20 // tests.
21 bool g_java_startup_tasks_complete = false;
22 
23 }  // namespace
24 
JNI_NativeBrowserTest_JavaStartupTasksCompleteForBrowserTests(JNIEnv * env)25 void JNI_NativeBrowserTest_JavaStartupTasksCompleteForBrowserTests(
26     JNIEnv* env) {
27   g_java_startup_tasks_complete = true;
28 }
29 
JavaAsyncStartupTasksCompleteForBrowserTests()30 bool JavaAsyncStartupTasksCompleteForBrowserTests() {
31   return g_java_startup_tasks_complete;
32 }
33 
34 }  // namespace android
35 }  // namespace testing
36