diff --git a/dev/manual_tests/pubspec.yaml b/dev/manual_tests/pubspec.yaml index dc9878f512..93ba9c9816 100644 --- a/dev/manual_tests/pubspec.yaml +++ b/dev/manual_tests/pubspec.yaml @@ -17,8 +17,6 @@ dev_dependencies: flutter_test: sdk: flutter - mockito: 4.1.1 - async: 2.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" charcode: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -36,4 +34,4 @@ dev_dependencies: flutter: uses-material-design: true -# PUBSPEC CHECKSUM: d387 +# PUBSPEC CHECKSUM: 7441 diff --git a/dev/manual_tests/test/mock_image_http.dart b/dev/manual_tests/test/mock_image_http.dart index 7c5c4aa6c5..cf2ef91fdc 100644 --- a/dev/manual_tests/test/mock_image_http.dart +++ b/dev/manual_tests/test/mock_image_http.dart @@ -2,38 +2,62 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; -import 'package:mockito/mockito.dart'; +import 'package:flutter_test/flutter_test.dart'; import '../../../packages/flutter/test/image_data.dart'; // Returns a mock HTTP client that responds with an image to all requests. -MockHttpClient createMockImageHttpClient(SecurityContext _) { - final MockHttpClient client = MockHttpClient(); - final MockHttpClientRequest request = MockHttpClientRequest(); - final MockHttpClientResponse response = MockHttpClientResponse(); - final MockHttpHeaders headers = MockHttpHeaders(); - when(client.getUrl(any)).thenAnswer((_) => Future.value(request)); - when(request.headers).thenReturn(headers); - when(request.close()).thenAnswer((_) => Future.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) onData = invocation.positionalArguments[0] as void Function(List); - final void Function() onDone = invocation.namedArguments[#onDone] as void Function(); - final void Function(Object, [StackTrace]) onError = invocation.namedArguments[#onError] as void Function(Object, [StackTrace]); - final bool cancelOnError = invocation.namedArguments[#cancelOnError] as bool; - return Stream>.fromIterable(>[kTransparentImage]).listen(onData, onDone: onDone, onError: onError, cancelOnError: cancelOnError); - }); +FakeHttpClient createMockImageHttpClient(SecurityContext _) { + final FakeHttpClient client = FakeHttpClient(); return client; } -class MockHttpClient extends Mock implements HttpClient {} +class FakeHttpClient extends Fake implements HttpClient { + @override + bool autoUncompress = false; -class MockHttpClientRequest extends Mock implements HttpClientRequest {} + final FakeHttpClientRequest request = FakeHttpClientRequest(); -class MockHttpClientResponse extends Mock implements HttpClientResponse {} + @override + Future getUrl(Uri url) async { + return request; + } +} -class MockHttpHeaders extends Mock implements HttpHeaders {} +class FakeHttpClientRequest extends Fake implements HttpClientRequest { + final FakeHttpClientResponse response = FakeHttpClientResponse(); + + @override + Future close() async { + return response; + } +} + +class FakeHttpClientResponse extends Fake implements HttpClientResponse { + @override + int get statusCode => 200; + + @override + int get contentLength => kTransparentImage.length; + + @override + final FakeHttpHeaders headers = FakeHttpHeaders(); + + @override + HttpClientResponseCompressionState get compressionState => HttpClientResponseCompressionState.notCompressed; + + @override + StreamSubscription> listen(void Function(List) onData, { + void Function() onDone, + Function onError, + bool cancelOnError, + }) { + return Stream>.fromIterable(>[kTransparentImage]) + .listen(onData, onDone: onDone, onError: onError, cancelOnError: cancelOnError); + } +} + +class FakeHttpHeaders extends Fake implements HttpHeaders {} diff --git a/packages/flutter_localizations/pubspec.yaml b/packages/flutter_localizations/pubspec.yaml index bf9364bc47..012e880496 100644 --- a/packages/flutter_localizations/pubspec.yaml +++ b/packages/flutter_localizations/pubspec.yaml @@ -21,7 +21,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mockito: 4.1.1 async: 2.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" boolean_selector: 2.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" @@ -35,4 +34,4 @@ dev_dependencies: term_glyph: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" test_api: 0.2.19 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" -# PUBSPEC CHECKSUM: 18bf +# PUBSPEC CHECKSUM: 9279 diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart index 0471f2cc6c..e640cf7140 100644 --- a/packages/flutter_tools/lib/src/commands/update_packages.dart +++ b/packages/flutter_tools/lib/src/commands/update_packages.dart @@ -29,7 +29,7 @@ const Map _kManuallyPinnedDependencies = { // existing tests do not fail when the package has a new version. 'flutter_gallery_assets': '^1.0.1', 'flutter_template_images': '1.0.1', // Must always exactly match flutter_tools template. - 'mockito': '4.1.1', // Prevent mockito from upgrading to the source gen version. + 'mockito': '4.1.1+1', // Prevent mockito from upgrading to the source gen version. 'vm_service_client': '0.2.6+2', // Final version before being marked deprecated. // DART TEAM OWNED NNBD DEPS 'archive': '">=3.0.0-nullsafety.0"', diff --git a/packages/flutter_tools/pubspec.yaml b/packages/flutter_tools/pubspec.yaml index 2871afdd95..c3959aad10 100644 --- a/packages/flutter_tools/pubspec.yaml +++ b/packages/flutter_tools/pubspec.yaml @@ -94,7 +94,7 @@ dependencies: dev_dependencies: collection: 1.15.0 - mockito: 4.1.1 + mockito: 4.1.1+1 file_testing: 3.0.0 test: 1.16.5 pubspec_parse: 0.1.8 @@ -108,4 +108,4 @@ dartdoc: # Exclude this package from the hosted API docs. nodoc: true -# PUBSPEC CHECKSUM: 09dc +# PUBSPEC CHECKSUM: 4339