Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
TestRunner.java
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
5package dev.flutter;
6
7import android.os.Bundle;
8import androidx.annotation.Nullable;
9import androidx.test.runner.AndroidJUnitRunner;
10import dev.flutter.scenariosui.ScreenshotUtil;
11import io.flutter.FlutterInjector;
12import io.flutter.embedding.engine.renderer.FlutterRenderer;
13
14public class TestRunner extends AndroidJUnitRunner {
15 @Override
16 public void onCreate(@Nullable Bundle arguments) {
17 String[] engineArguments = null;
18 assert arguments != null;
19 if ("true".equals(arguments.getString("enable-impeller"))) {
20 // Set up the global settings object so that Impeller is enabled for all tests.
21 engineArguments =
22 new String[] {
23 "--enable-impeller=true",
24 "--impeller-backend=" + arguments.getString("impeller-backend", "vulkan")
25 };
26 }
27 FlutterRenderer.debugDisableSurfaceClear = true;
28 if ("true".equals(arguments.getString("force-surface-producer-surface-texture"))) {
29 // Set a test flag to force the SurfaceProducer to use SurfaceTexture.
30 FlutterRenderer.debugForceSurfaceProducerGlTextures = true;
31 }
32 // For consistency, just always initilaize FlutterJNI etc.
33 FlutterInjector.instance().flutterLoader().startInitialization(getTargetContext());
34 FlutterInjector.instance()
35 .flutterLoader()
36 .ensureInitializationComplete(getTargetContext(), engineArguments);
37 ScreenshotUtil.onCreate();
38 super.onCreate(arguments);
39 }
40
41 @Override
42 public void finish(int resultCode, @Nullable Bundle results) {
43 ScreenshotUtil.finish();
44 super.finish(resultCode, results);
45 }
46}
static bool equals(T *a, T *b)
void onCreate(@Nullable Bundle arguments)
void finish(int resultCode, @Nullable Bundle results)