fix(flutter_driver): Properly declare socket as nullable (#75769)

This commit is contained in:
Wyte Krongapiradee
2021-02-12 02:51:04 +08:00
committed by GitHub
parent e7953b3be4
commit 6db3d61ed4
2 changed files with 16 additions and 3 deletions

View File

@@ -52,6 +52,19 @@ void main() {
restoreVmServiceConnectFunction();
});
test('Retries while Dart VM service is not available', () async {
// This test case will test the real implementation of `_waitAndConnect`.
restoreVmServiceConnectFunction();
// The actual behavior is to retry indefinitely until the Dart VM service
// becomes available. `.timeout` is used here to exit the infinite loop,
// expecting that no other types of error are thrown during the process.
expect(
vmServiceConnectFunction('http://foo.bar', <String, dynamic>{})
.timeout(const Duration(seconds: 1)),
throwsA(isA<TimeoutException>()),
);
});
test('throws after retries if no isolate', () async {
fakeVM.numberOfTriesBeforeResolvingIsolate = 10000;