From 19af02be83e4d42eae9ae6304dc1142ec59e2e8a Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Thu, 22 Aug 2019 18:03:38 -0700 Subject: [PATCH] Fix tests after breaking change https://github.com/flutter/flutter/pull/38464 --- packages/camera/test/camera_test.dart | 2 ++ packages/camera/test/support_android/support_android_test.dart | 2 ++ packages/connectivity/test/connectivity_test.dart | 2 ++ packages/google_maps_flutter/test/circle_updates_test.dart | 2 ++ packages/google_maps_flutter/test/google_map_test.dart | 2 ++ packages/google_maps_flutter/test/marker_updates_test.dart | 2 ++ packages/google_maps_flutter/test/polygon_updates_test.dart | 2 ++ packages/google_maps_flutter/test/polyline_updates_test.dart | 2 ++ packages/google_sign_in/test/google_sign_in_test.dart | 2 ++ packages/image_picker/test/image_picker_test.dart | 2 ++ .../billing_client_wrappers/billing_client_wrapper_test.dart | 2 ++ .../in_app_purchase_connection/app_store_connection_test.dart | 3 +++ .../google_play_connection_test.dart | 3 +++ .../test/store_kit_wrappers/sk_methodchannel_apis_test.dart | 2 ++ packages/path_provider/test/path_provider_test.dart | 2 ++ packages/quick_actions/test/quick_actions_test.dart | 2 ++ packages/share/test/share_test.dart | 3 +++ packages/shared_preferences/test/shared_preferences_test.dart | 2 ++ packages/url_launcher/test/url_launcher_test.dart | 2 ++ packages/webview_flutter/test/webview_flutter_test.dart | 2 ++ 20 files changed, 43 insertions(+) diff --git a/packages/camera/test/camera_test.dart b/packages/camera/test/camera_test.dart index 39b08ecd8020..fbb955689e48 100644 --- a/packages/camera/test/camera_test.dart +++ b/packages/camera/test/camera_test.dart @@ -9,6 +9,8 @@ import 'package:camera/new/src/camera_testing.dart'; import 'package:camera/new/src/common/native_texture.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('Camera', () { final List log = []; diff --git a/packages/camera/test/support_android/support_android_test.dart b/packages/camera/test/support_android/support_android_test.dart index 114f56ab3348..399acd3698ce 100644 --- a/packages/camera/test/support_android/support_android_test.dart +++ b/packages/camera/test/support_android/support_android_test.dart @@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:camera/new/src/camera_testing.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('Support Android Camera', () { group('$Camera', () { final List log = []; diff --git a/packages/connectivity/test/connectivity_test.dart b/packages/connectivity/test/connectivity_test.dart index 9bfe0fb89abb..311926b8b963 100644 --- a/packages/connectivity/test/connectivity_test.dart +++ b/packages/connectivity/test/connectivity_test.dart @@ -7,6 +7,8 @@ import 'package:connectivity/connectivity.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('$Connectivity', () { final List log = []; diff --git a/packages/google_maps_flutter/test/circle_updates_test.dart b/packages/google_maps_flutter/test/circle_updates_test.dart index fe7620571443..4a3f14134e34 100644 --- a/packages/google_maps_flutter/test/circle_updates_test.dart +++ b/packages/google_maps_flutter/test/circle_updates_test.dart @@ -34,6 +34,8 @@ Widget _mapWithCircles(Set circles) { } void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController(); diff --git a/packages/google_maps_flutter/test/google_map_test.dart b/packages/google_maps_flutter/test/google_map_test.dart index e745c15ad181..15332a92751b 100644 --- a/packages/google_maps_flutter/test/google_map_test.dart +++ b/packages/google_maps_flutter/test/google_map_test.dart @@ -10,6 +10,8 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'fake_maps_controllers.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController(); diff --git a/packages/google_maps_flutter/test/marker_updates_test.dart b/packages/google_maps_flutter/test/marker_updates_test.dart index f43fcfa52408..cb5731d72875 100644 --- a/packages/google_maps_flutter/test/marker_updates_test.dart +++ b/packages/google_maps_flutter/test/marker_updates_test.dart @@ -34,6 +34,8 @@ Widget _mapWithMarkers(Set markers) { } void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController(); diff --git a/packages/google_maps_flutter/test/polygon_updates_test.dart b/packages/google_maps_flutter/test/polygon_updates_test.dart index f7b2c1cb8286..77f096b70484 100644 --- a/packages/google_maps_flutter/test/polygon_updates_test.dart +++ b/packages/google_maps_flutter/test/polygon_updates_test.dart @@ -34,6 +34,8 @@ Widget _mapWithPolygons(Set polygons) { } void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController(); diff --git a/packages/google_maps_flutter/test/polyline_updates_test.dart b/packages/google_maps_flutter/test/polyline_updates_test.dart index 1d04aef485fb..6946df4c05ee 100644 --- a/packages/google_maps_flutter/test/polyline_updates_test.dart +++ b/packages/google_maps_flutter/test/polyline_updates_test.dart @@ -34,6 +34,8 @@ Widget _mapWithPolylines(Set polylines) { } void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakePlatformViewsController fakePlatformViewsController = FakePlatformViewsController(); diff --git a/packages/google_sign_in/test/google_sign_in_test.dart b/packages/google_sign_in/test/google_sign_in_test.dart index b2ae89a0e886..dab480a4cce4 100755 --- a/packages/google_sign_in/test/google_sign_in_test.dart +++ b/packages/google_sign_in/test/google_sign_in_test.dart @@ -10,6 +10,8 @@ import 'package:google_sign_in/google_sign_in.dart'; import 'package:google_sign_in/testing.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('GoogleSignIn', () { const MethodChannel channel = MethodChannel( 'plugins.flutter.io/google_sign_in', diff --git a/packages/image_picker/test/image_picker_test.dart b/packages/image_picker/test/image_picker_test.dart index 78e818538c4a..1a40e11d76e1 100644 --- a/packages/image_picker/test/image_picker_test.dart +++ b/packages/image_picker/test/image_picker_test.dart @@ -7,6 +7,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:image_picker/image_picker.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('$ImagePicker', () { const MethodChannel channel = MethodChannel('plugins.flutter.io/image_picker'); diff --git a/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart b/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart index f5c5a5b8a73c..818250607ed7 100644 --- a/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart +++ b/packages/in_app_purchase/test/billing_client_wrappers/billing_client_wrapper_test.dart @@ -13,6 +13,8 @@ import 'sku_details_wrapper_test.dart'; import 'purchase_wrapper_test.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final StubInAppPurchasePlatform stubPlatform = StubInAppPurchasePlatform(); BillingClient billingClient; diff --git a/packages/in_app_purchase/test/in_app_purchase_connection/app_store_connection_test.dart b/packages/in_app_purchase/test/in_app_purchase_connection/app_store_connection_test.dart index f54a58fbe176..ae24167b6a7c 100644 --- a/packages/in_app_purchase/test/in_app_purchase_connection/app_store_connection_test.dart +++ b/packages/in_app_purchase/test/in_app_purchase_connection/app_store_connection_test.dart @@ -6,6 +6,7 @@ import 'dart:async'; import 'dart:io'; import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; import 'package:in_app_purchase/src/in_app_purchase/purchase_details.dart'; import 'package:test/test.dart'; @@ -17,6 +18,8 @@ import 'package:in_app_purchase/store_kit_wrappers.dart'; import '../store_kit_wrappers/sk_test_stub_objects.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakeIOSPlatform fakeIOSPlatform = FakeIOSPlatform(); setUpAll(() { diff --git a/packages/in_app_purchase/test/in_app_purchase_connection/google_play_connection_test.dart b/packages/in_app_purchase/test/in_app_purchase_connection/google_play_connection_test.dart index 68a62c51d726..512664a24af0 100644 --- a/packages/in_app_purchase/test/in_app_purchase_connection/google_play_connection_test.dart +++ b/packages/in_app_purchase/test/in_app_purchase_connection/google_play_connection_test.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; import 'package:in_app_purchase/src/in_app_purchase/purchase_details.dart'; import 'package:test/test.dart'; @@ -20,6 +21,8 @@ import '../billing_client_wrappers/sku_details_wrapper_test.dart'; import '../billing_client_wrappers/purchase_wrapper_test.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final StubInAppPurchasePlatform stubPlatform = StubInAppPurchasePlatform(); GooglePlayConnection connection; const String startConnectionCall = diff --git a/packages/in_app_purchase/test/store_kit_wrappers/sk_methodchannel_apis_test.dart b/packages/in_app_purchase/test/store_kit_wrappers/sk_methodchannel_apis_test.dart index f644e6f66ff1..bb40edc0fd15 100644 --- a/packages/in_app_purchase/test/store_kit_wrappers/sk_methodchannel_apis_test.dart +++ b/packages/in_app_purchase/test/store_kit_wrappers/sk_methodchannel_apis_test.dart @@ -9,6 +9,8 @@ import 'package:in_app_purchase/store_kit_wrappers.dart'; import 'sk_test_stub_objects.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final FakeIOSPlatform fakeIOSPlatform = FakeIOSPlatform(); setUpAll(() { diff --git a/packages/path_provider/test/path_provider_test.dart b/packages/path_provider/test/path_provider_test.dart index 9da5a2568a9a..ec02cf8bbb0e 100644 --- a/packages/path_provider/test/path_provider_test.dart +++ b/packages/path_provider/test/path_provider_test.dart @@ -9,6 +9,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:path_provider/path_provider.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + const MethodChannel channel = MethodChannel('plugins.flutter.io/path_provider'); final List log = []; diff --git a/packages/quick_actions/test/quick_actions_test.dart b/packages/quick_actions/test/quick_actions_test.dart index 115efc5786aa..98a412e3e06d 100644 --- a/packages/quick_actions/test/quick_actions_test.dart +++ b/packages/quick_actions/test/quick_actions_test.dart @@ -6,6 +6,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:quick_actions/quick_actions.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + QuickActions quickActions; final List log = []; diff --git a/packages/share/test/share_test.dart b/packages/share/test/share_test.dart index 48df12cffa1c..697e0925708a 100644 --- a/packages/share/test/share_test.dart +++ b/packages/share/test/share_test.dart @@ -4,6 +4,7 @@ import 'dart:ui'; +import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; import 'package:mockito/mockito.dart'; import 'package:share/share.dart'; import 'package:test/test.dart'; @@ -11,6 +12,8 @@ import 'package:test/test.dart'; import 'package:flutter/services.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + MockMethodChannel mockChannel; setUp(() { diff --git a/packages/shared_preferences/test/shared_preferences_test.dart b/packages/shared_preferences/test/shared_preferences_test.dart index c0d9068204c9..8ebcb96c0ad8 100755 --- a/packages/shared_preferences/test/shared_preferences_test.dart +++ b/packages/shared_preferences/test/shared_preferences_test.dart @@ -7,6 +7,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + group('$SharedPreferences', () { const MethodChannel channel = MethodChannel( 'plugins.flutter.io/shared_preferences', diff --git a/packages/url_launcher/test/url_launcher_test.dart b/packages/url_launcher/test/url_launcher_test.dart index 93f4acf71601..a70392810f86 100644 --- a/packages/url_launcher/test/url_launcher_test.dart +++ b/packages/url_launcher/test/url_launcher_test.dart @@ -7,6 +7,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:url_launcher/url_launcher.dart'; void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + const MethodChannel channel = MethodChannel('plugins.flutter.io/url_launcher'); final List log = []; diff --git a/packages/webview_flutter/test/webview_flutter_test.dart b/packages/webview_flutter/test/webview_flutter_test.dart index 6907436b24a2..d3f289018073 100644 --- a/packages/webview_flutter/test/webview_flutter_test.dart +++ b/packages/webview_flutter/test/webview_flutter_test.dart @@ -16,6 +16,8 @@ import 'package:webview_flutter/webview_flutter.dart'; typedef void VoidCallback(); void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final _FakePlatformViewsController fakePlatformViewsController = _FakePlatformViewsController();