10
10
import androidx .test .InstrumentationRegistry ;
11
11
import androidx .test .internal .runner .junit4 .statement .UiThreadStatement ;
12
12
import androidx .test .runner .AndroidJUnit4 ;
13
+ import com .google .common .util .concurrent .SettableFuture ;
13
14
import io .flutter .embedding .engine .FlutterEngine ;
14
15
import io .flutter .embedding .engine .dart .DartExecutor ;
15
16
import java .util .Arrays ;
16
17
import java .util .Locale ;
17
- import java .util .concurrent .CompletableFuture ;
18
18
import java .util .concurrent .ExecutionException ;
19
19
import java .util .concurrent .TimeUnit ;
20
20
import java .util .concurrent .TimeoutException ;
@@ -34,7 +34,7 @@ public void smokeTestEngineLaunch() throws Throwable {
34
34
// as @UiThreadTest because having the message handler and the CompletableFuture both being
35
35
// on the same thread will create deadlocks.
36
36
UiThreadStatement .runOnUiThread (() -> engine .set (new FlutterEngine (applicationContext )));
37
- CompletableFuture <Boolean > statusReceived = new CompletableFuture <>();
37
+ SettableFuture <Boolean > statusReceived = new SettableFuture <>();
38
38
39
39
// Resolve locale to `en_US`.
40
40
// This is required, so `window.locale` in populated in dart.
@@ -49,8 +49,7 @@ public void smokeTestEngineLaunch() throws Throwable {
49
49
.get ()
50
50
.getDartExecutor ()
51
51
.setMessageHandler (
52
- "waiting_for_status" ,
53
- (byteBuffer , binaryReply ) -> statusReceived .complete (Boolean .TRUE ));
52
+ "waiting_for_status" , (byteBuffer , binaryReply ) -> statusReceived .set (Boolean .TRUE ));
54
53
55
54
// Launching the entrypoint will run the Dart code that sends the "waiting_for_status" platform
56
55
// message.
0 commit comments