Unverified Commit 54673633 authored by derdilla's avatar derdilla Committed by GitHub

Cover some Services tests with leak tracing (#134381)

parent d2ff2417
......@@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
class TestAssetBundle extends CachingAssetBundle {
Map<String, int> loadCallCount = <String, int>{};
......@@ -135,7 +136,7 @@ void main() {
expect(await data, 1);
});
testWidgets('loadStructuredData handles exceptions correctly', (WidgetTester tester) async {
testWidgetsWithLeakTracking('loadStructuredData handles exceptions correctly', (WidgetTester tester) async {
final TestAssetBundle bundle = TestAssetBundle();
try {
await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.error('what do they say?'));
......@@ -145,7 +146,7 @@ void main() {
}
});
testWidgets('loadStructuredBinaryData handles exceptions correctly', (WidgetTester tester) async {
testWidgetsWithLeakTracking('loadStructuredBinaryData handles exceptions correctly', (WidgetTester tester) async {
final TestAssetBundle bundle = TestAssetBundle();
try {
await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.error('buy more crystals'));
......
......@@ -6,9 +6,10 @@ import 'dart:ui';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
void main() {
testWidgets('initialLifecycleState is used to init state paused', (WidgetTester tester) async {
testWidgetsWithLeakTracking('initialLifecycleState is used to init state paused', (WidgetTester tester) async {
expect(ServicesBinding.instance.lifecycleState, isNull);
final TestWidgetsFlutterBinding binding = tester.binding;
binding.resetLifecycleState();
......@@ -20,7 +21,7 @@ void main() {
// even though no lifecycle event was fired from the platform.
expect(binding.lifecycleState.toString(), equals('AppLifecycleState.paused'));
});
testWidgets('Handles all of the allowed states of AppLifecycleState', (WidgetTester tester) async {
testWidgetsWithLeakTracking('Handles all of the allowed states of AppLifecycleState', (WidgetTester tester) async {
final TestWidgetsFlutterBinding binding = tester.binding;
for (final AppLifecycleState state in AppLifecycleState.values) {
binding.resetLifecycleState();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment