Add a compressionState value to HttpResponse mocks (#66679)

The Dart SDK now requires non-null enum values if the enum is used in an
exhaustive switch statement on a non-nullable type.

See https://github.com/flutter/flutter/issues/66674
This commit is contained in:
Jason Simmons 2020-09-25 14:14:45 -07:00 committed by GitHub
parent 3e8fb33c08
commit e6b9b5efb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ MockHttpClient createMockImageHttpClient(SecurityContext _) {
when(request.close()).thenAnswer((_) => Future<HttpClientResponse>.value(response));
when(response.contentLength).thenReturn(kTransparentImage.length);
when(response.statusCode).thenReturn(HttpStatus.ok);
when(response.compressionState).thenReturn(HttpClientResponseCompressionState.notCompressed);
when(response.listen(any)).thenAnswer((Invocation invocation) {
final void Function(List<int>) onData = invocation.positionalArguments[0] as void Function(List<int>);
final void Function() onDone = invocation.namedArguments[#onDone] as void Function();