Skip to content

Commit 8407dd2

Browse files
authored
Revert "Integrate testWidgets with leak tracking. (#138057)" (#140502)
The PR is breaking the `flutter_test_performance` test and making the tree red.
1 parent d746007 commit 8407dd2

File tree

4 files changed

+0
-298
lines changed

4 files changed

+0
-298
lines changed

packages/flutter_test/lib/src/test_compat.dart

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'dart:async';
66

7-
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
87
import 'package:meta/meta.dart';
98
import 'package:test_api/scaffolding.dart' show Timeout;
109
import 'package:test_api/src/backend/declarer.dart'; // ignore: implementation_imports
@@ -164,7 +163,6 @@ void test(
164163
Map<String, dynamic>? onPlatform,
165164
int? retry,
166165
}) {
167-
_configureTearDownForTestFile();
168166
_declarer.test(
169167
description.toString(),
170168
body,
@@ -188,7 +186,6 @@ void test(
188186
/// of running the group's tests.
189187
@isTestGroup
190188
void group(Object description, void Function() body, { dynamic skip, int? retry }) {
191-
_configureTearDownForTestFile();
192189
_declarer.group(description.toString(), body, skip: skip, retry: retry);
193190
}
194191

@@ -204,7 +201,6 @@ void group(Object description, void Function() body, { dynamic skip, int? retry
204201
/// Each callback at the top level or in a given group will be run in the order
205202
/// they were declared.
206203
void setUp(dynamic Function() body) {
207-
_configureTearDownForTestFile();
208204
_declarer.setUp(body);
209205
}
210206

@@ -222,7 +218,6 @@ void setUp(dynamic Function() body) {
222218
///
223219
/// See also [addTearDown], which adds tear-downs to a running test.
224220
void tearDown(dynamic Function() body) {
225-
_configureTearDownForTestFile();
226221
_declarer.tearDown(body);
227222
}
228223

@@ -240,7 +235,6 @@ void tearDown(dynamic Function() body) {
240235
/// prefer [setUp], and only use [setUpAll] if the callback is prohibitively
241236
/// slow.
242237
void setUpAll(dynamic Function() body) {
243-
_configureTearDownForTestFile();
244238
_declarer.setUpAll(body);
245239
}
246240

@@ -256,27 +250,9 @@ void setUpAll(dynamic Function() body) {
256250
/// prefer [tearDown], and only use [tearDownAll] if the callback is
257251
/// prohibitively slow.
258252
void tearDownAll(dynamic Function() body) {
259-
_configureTearDownForTestFile();
260253
_declarer.tearDownAll(body);
261254
}
262255

263-
bool _isTearDownForTestFileConfigured = false;
264-
/// Configures `tearDownAll` after all user defined `tearDownAll` in the test file.
265-
///
266-
/// This function should be invoked in all functions, that may be invoked by user in the test file,
267-
/// to be invoked before any other `tearDownAll`.
268-
void _configureTearDownForTestFile() {
269-
if (_isTearDownForTestFileConfigured) {
270-
return;
271-
}
272-
_declarer.tearDownAll(_tearDownForTestFile);
273-
_isTearDownForTestFileConfigured = true;
274-
}
275-
276-
/// Tear down that should happen after all user defined tear down.
277-
Future<void> _tearDownForTestFile() async {
278-
await maybeTearDownLeakTrackingForAll();
279-
}
280256

281257
/// A reporter that prints each test on its own line.
282258
///

packages/flutter_test/lib/src/widget_tester.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:flutter/material.dart' show Tooltip;
99
import 'package:flutter/rendering.dart';
1010
import 'package:flutter/scheduler.dart';
1111
import 'package:flutter/services.dart';
12-
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
1312
import 'package:matcher/expect.dart' as matcher_expect;
1413
import 'package:meta/meta.dart';
1514
import 'package:test_api/scaffolding.dart' as test_package;
@@ -117,18 +116,6 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
117116
/// If the [tags] are passed, they declare user-defined tags that are implemented by
118117
/// the `test` package.
119118
///
120-
/// The argument [experimentalLeakTesting] is experimental and is not recommended
121-
/// for use outside of the Flutter framework.
122-
/// When [experimentalLeakTesting] is set, it is used to leak track objects created
123-
/// during test execution.
124-
/// Otherwise [LeakTesting.settings] is used.
125-
/// Adjust [LeakTesting.settings] in flutter_test_config.dart
126-
/// (see https://github.com/flutter/flutter/blob/master/packages/flutter_test/lib/flutter_test.dart)
127-
/// for the entire package or folder, or in the test's main for a test file
128-
/// (don't use [setUp] or [setUpAll]).
129-
/// To turn off leak tracking just for one test, set [experimentalLeakTesting] to
130-
/// `LeakTrackingForTests.ignore()`.
131-
///
132119
/// ## Sample code
133120
///
134121
/// ```dart
@@ -148,7 +135,6 @@ void testWidgets(
148135
TestVariant<Object?> variant = const DefaultTestVariant(),
149136
dynamic tags,
150137
int? retry,
151-
LeakTesting? experimentalLeakTesting,
152138
}) {
153139
assert(variant.values.isNotEmpty, 'There must be at least one value to test in the testing variant.');
154140
final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
@@ -179,11 +165,9 @@ void testWidgets(
179165
Object? memento;
180166
try {
181167
memento = await variant.setUp(value);
182-
maybeSetupLeakTrackingForTest(experimentalLeakTesting, combinedDescription);
183168
await callback(tester);
184169
} finally {
185170
await variant.tearDown(value, memento);
186-
maybeTearDownLeakTrackingForTest();
187171
}
188172
semanticsHandle?.dispose();
189173
},

packages/flutter_test/test/utils/leaking_classes.dart

Lines changed: 0 additions & 54 deletions
This file was deleted.

packages/flutter_test/test/widget_tester_leaks_test.dart

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)