1package io.flutter.embedding.engine.renderer;
3import static org.mockito.Mockito.mock;
4import static org.mockito.Mockito.when;
8import androidx.test.core.app.ApplicationProvider;
9import io.flutter.embedding.android.FlutterActivity;
10import io.flutter.embedding.engine.FlutterEngine;
11import io.flutter.embedding.engine.FlutterEngineCache;
12import io.flutter.embedding.engine.FlutterJNI;
13import io.flutter.embedding.engine.loader.FlutterLoader;
14import org.junit.rules.TestWatcher;
15import org.junit.runner.Description;
21 private static final String cachedEngineId =
"flutter_engine_rule_cached_engine";
22 private final Context ctx = ApplicationProvider.getApplicationContext();
25 private boolean jniIsAttached =
true;
28 protected void starting(Description description) {
31 when(flutterJNI.
isAttached()).thenAnswer(
i -> jniIsAttached);
38 flutterEngine =
new FlutterEngine(ctx, mockFlutterLoader, flutterJNI);
45 protected void finished(Description description) {
55 return this.flutterJNI;
64 return this.flutterEngine;
73 this.jniIsAttached = isAttached;
Intent build(@NonNull Context context)
static CachedEngineIntentBuilder withCachedEngine(@NonNull String cachedEngineId)
static FlutterEngineCache getInstance()
void put(@NonNull String engineId, @Nullable FlutterEngine engine)
boolean automaticallyRegisterPlugins()
void setJniIsAttached(boolean isAttached)
FlutterJNI getFlutterJNI()
void finished(Description description)
FlutterEngine getFlutterEngine()
void starting(Description description)