Skip to content

Commit 5467363

Browse files
authored
Cover some Services tests with leak tracing (flutter#134381)
1 parent d2ff241 commit 5467363

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/flutter/test/services/asset_bundle_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart';
88
import 'package:flutter/painting.dart';
99
import 'package:flutter/services.dart';
1010
import 'package:flutter_test/flutter_test.dart';
11+
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
1112

1213
class TestAssetBundle extends CachingAssetBundle {
1314
Map<String, int> loadCallCount = <String, int>{};
@@ -135,7 +136,7 @@ void main() {
135136
expect(await data, 1);
136137
});
137138

138-
testWidgets('loadStructuredData handles exceptions correctly', (WidgetTester tester) async {
139+
testWidgetsWithLeakTracking('loadStructuredData handles exceptions correctly', (WidgetTester tester) async {
139140
final TestAssetBundle bundle = TestAssetBundle();
140141
try {
141142
await bundle.loadStructuredData('AssetManifest.json', (String value) => Future<String>.error('what do they say?'));
@@ -145,7 +146,7 @@ void main() {
145146
}
146147
});
147148

148-
testWidgets('loadStructuredBinaryData handles exceptions correctly', (WidgetTester tester) async {
149+
testWidgetsWithLeakTracking('loadStructuredBinaryData handles exceptions correctly', (WidgetTester tester) async {
149150
final TestAssetBundle bundle = TestAssetBundle();
150151
try {
151152
await bundle.loadStructuredBinaryData('AssetManifest.bin', (ByteData value) => Future<String>.error('buy more crystals'));

packages/flutter/test/services/lifecycle_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import 'dart:ui';
66

77
import 'package:flutter/services.dart';
88
import 'package:flutter_test/flutter_test.dart';
9+
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
910

1011
void main() {
11-
testWidgets('initialLifecycleState is used to init state paused', (WidgetTester tester) async {
12+
testWidgetsWithLeakTracking('initialLifecycleState is used to init state paused', (WidgetTester tester) async {
1213
expect(ServicesBinding.instance.lifecycleState, isNull);
1314
final TestWidgetsFlutterBinding binding = tester.binding;
1415
binding.resetLifecycleState();
@@ -20,7 +21,7 @@ void main() {
2021
// even though no lifecycle event was fired from the platform.
2122
expect(binding.lifecycleState.toString(), equals('AppLifecycleState.paused'));
2223
});
23-
testWidgets('Handles all of the allowed states of AppLifecycleState', (WidgetTester tester) async {
24+
testWidgetsWithLeakTracking('Handles all of the allowed states of AppLifecycleState', (WidgetTester tester) async {
2425
final TestWidgetsFlutterBinding binding = tester.binding;
2526
for (final AppLifecycleState state in AppLifecycleState.values) {
2627
binding.resetLifecycleState();

0 commit comments

Comments
 (0)