Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 39fbe2c

Browse files
committed
[e2e] Use SettableFutures instead of CompletableFuture
This works better for internal use cases.
1 parent 388c66e commit 39fbe2c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

packages/e2e/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.0
2+
3+
* **Breaking change** `E2EPlugin` exports a `ListenableFuture` for `testResults`.
4+
15
## 0.5.0+1
26

37
* Fixed the device pixel ratio problem.

packages/e2e/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ android {
3333
}
3434
dependencies {
3535
api 'junit:junit:4.12'
36-
implementation 'net.sourceforge.streamsupport:android-retrofuture:1.7.2'
3736

3837
// https://developer.android.com/jetpack/androidx/releases/test/#1.2.0
3938
api 'androidx.test:runner:1.2.0'
4039
api 'androidx.test:rules:1.2.0'
4140
api 'androidx.test.espresso:espresso-core:3.2.0'
41+
api 'com.google.guava:guava:28.1-android'
4242
}
4343
}

packages/e2e/android/src/main/java/dev/flutter/plugins/e2e/E2EPlugin.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package dev.flutter.plugins.e2e;
66

77
import android.content.Context;
8+
import com.google.common.util.concurrent.ListenableFuture;
9+
import com.google.common.util.concurrent.SettableFuture;
810
import io.flutter.embedding.engine.plugins.FlutterPlugin;
911
import io.flutter.plugin.common.BinaryMessenger;
1012
import io.flutter.plugin.common.MethodCall;
@@ -13,13 +15,14 @@
1315
import io.flutter.plugin.common.MethodChannel.Result;
1416
import io.flutter.plugin.common.PluginRegistry.Registrar;
1517
import java.util.Map;
16-
import java9.util.concurrent.CompletableFuture;
1718

1819
/** E2EPlugin */
1920
public class E2EPlugin implements MethodCallHandler, FlutterPlugin {
2021
private MethodChannel methodChannel;
2122

22-
public static CompletableFuture<Map<String, String>> testResults = new CompletableFuture<>();
23+
private static final SettableFuture<Map<String, String>> testResultsSettable =
24+
SettableFuture.create();
25+
public static final ListenableFuture<Map<String, String>> testResults = testResultsSettable;
2326

2427
private static final String CHANNEL = "plugins.flutter.io/e2e";
2528

@@ -49,7 +52,7 @@ public void onDetachedFromEngine(FlutterPluginBinding binding) {
4952
public void onMethodCall(MethodCall call, Result result) {
5053
if (call.method.equals("allTestsFinished")) {
5154
Map<String, String> results = call.argument("results");
52-
testResults.complete(results);
55+
testResultsSettable.set(results);
5356
result.success(null);
5457
} else {
5558
result.notImplemented();

0 commit comments

Comments
 (0)