Skip to content

Commit 14b832a

Browse files
authored
cover more tests with leak tracking (flutter#134837)
1 parent 52ef9d8 commit 14b832a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/flutter/test/scheduler/ticker_test.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
66
import 'package:flutter/scheduler.dart';
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() {
1112
Future<void> setAppLifeCycleState(AppLifecycleState state) async {
@@ -15,7 +16,7 @@ void main() {
1516
.handlePlatformMessage('flutter/lifecycle', message, (_) {});
1617
}
1718

18-
testWidgets('Ticker mute control test', (WidgetTester tester) async {
19+
testWidgetsWithLeakTracking('Ticker mute control test', (WidgetTester tester) async {
1920
int tickCount = 0;
2021
void handleTick(Duration duration) {
2122
tickCount += 1;
@@ -97,7 +98,7 @@ void main() {
9798
expect(ticker.isActive, isFalse);
9899
});
99100

100-
testWidgets('Ticker control test', (WidgetTester tester) async {
101+
testWidgetsWithLeakTracking('Ticker control test', (WidgetTester tester) async {
101102
late Ticker ticker;
102103

103104
void testFunction() {
@@ -110,7 +111,7 @@ void main() {
110111
expect(ticker.toString(debugIncludeStack: true), contains('testFunction'));
111112
});
112113

113-
testWidgets('Ticker can be sped up with time dilation', (WidgetTester tester) async {
114+
testWidgetsWithLeakTracking('Ticker can be sped up with time dilation', (WidgetTester tester) async {
114115
timeDilation = 0.5; // Move twice as fast.
115116
late Duration lastDuration;
116117
void handleTick(Duration duration) {
@@ -128,7 +129,7 @@ void main() {
128129
timeDilation = 1.0; // restore time dilation, or it will affect other tests
129130
});
130131

131-
testWidgets('Ticker can be slowed down with time dilation', (WidgetTester tester) async {
132+
testWidgetsWithLeakTracking('Ticker can be slowed down with time dilation', (WidgetTester tester) async {
132133
timeDilation = 2.0; // Move half as fast.
133134
late Duration lastDuration;
134135
void handleTick(Duration duration) {
@@ -146,7 +147,7 @@ void main() {
146147
timeDilation = 1.0; // restore time dilation, or it will affect other tests
147148
});
148149

149-
testWidgets('Ticker stops ticking when application is paused', (WidgetTester tester) async {
150+
testWidgetsWithLeakTracking('Ticker stops ticking when application is paused', (WidgetTester tester) async {
150151
int tickCount = 0;
151152
void handleTick(Duration duration) {
152153
tickCount += 1;
@@ -169,7 +170,7 @@ void main() {
169170
setAppLifeCycleState(AppLifecycleState.resumed);
170171
});
171172

172-
testWidgets('Ticker can be created before application unpauses', (WidgetTester tester) async {
173+
testWidgetsWithLeakTracking('Ticker can be created before application unpauses', (WidgetTester tester) async {
173174
setAppLifeCycleState(AppLifecycleState.paused);
174175

175176
int tickCount = 0;

0 commit comments

Comments
 (0)