Skip to content

Commit f5bce71

Browse files
authored
Revert "Serve DevTools when running flutter test (#123607)" (#123810)
This reverts commit c3de901.
1 parent 7d31fe3 commit f5bce71

File tree

2 files changed

+6
-61
lines changed

2 files changed

+6
-61
lines changed

packages/flutter_tools/lib/src/test/flutter_tester_device.dart

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import '../convert.dart';
2121
import '../device.dart';
2222
import '../globals.dart' as globals;
2323
import '../project.dart';
24-
import '../resident_runner.dart';
2524
import '../vmservice.dart';
2625

2726
import 'font_config_manager.dart';
@@ -73,7 +72,6 @@ class FlutterTesterTestDevice extends TestDevice {
7372

7473
Process? _process;
7574
HttpServer? _server;
76-
DevtoolsLauncher? _devToolsLauncher;
7775

7876
/// Starts the device.
7977
///
@@ -165,11 +163,9 @@ class FlutterTesterTestDevice extends TestDevice {
165163
debuggingOptions.hostVmServicePort == detectedUri.port);
166164

167165
Uri? forwardingUri;
168-
DartDevelopmentService? dds;
169-
170166
if (debuggingOptions.enableDds) {
171167
logger.printTrace('test $id: Starting Dart Development Service');
172-
dds = await startDds(
168+
final DartDevelopmentService dds = await startDds(
173169
detectedUri,
174170
uriConverter: uriConverter,
175171
);
@@ -197,10 +193,10 @@ class FlutterTesterTestDevice extends TestDevice {
197193
}));
198194

199195
if (debuggingOptions.startPaused && !machine!) {
200-
logger.printStatus('The Dart VM service is listening on $forwardingUri');
201-
await _startDevTools(forwardingUri, dds);
202-
logger.printStatus('');
203-
logger.printStatus('The test process has been started. Set any relevant breakpoints and then resume the test in the debugger.');
196+
logger.printStatus('The test process has been started.');
197+
logger.printStatus('You can now connect to it using vmService. To connect, load the following Web site in your browser:');
198+
logger.printStatus(' $forwardingUri');
199+
logger.printStatus('You should first set appropriate breakpoints, then resume the test in the debugger.');
204200
}
205201
_gotProcessVmServiceUri.complete(forwardingUri);
206202
},
@@ -219,9 +215,6 @@ class FlutterTesterTestDevice extends TestDevice {
219215
logger.printTrace('test $id: Terminating flutter_tester process');
220216
_process?.kill(io.ProcessSignal.sigkill);
221217

222-
logger.printTrace('test $id: Shutting down DevTools server');
223-
await _devToolsLauncher?.close();
224-
225218
logger.printTrace('test $id: Shutting down test harness socket server');
226219
await _server?.close(force: true);
227220
await finished;
@@ -268,29 +261,6 @@ class FlutterTesterTestDevice extends TestDevice {
268261
);
269262
}
270263

271-
Future<void> _startDevTools(Uri forwardingUri, DartDevelopmentService? dds) async {
272-
_devToolsLauncher = DevtoolsLauncher.instance;
273-
logger.printTrace('test $id: Serving DevTools...');
274-
final DevToolsServerAddress? devToolsServerAddress = await _devToolsLauncher?.serve();
275-
276-
if (devToolsServerAddress == null) {
277-
logger.printTrace('test $id: Failed to start DevTools');
278-
return;
279-
}
280-
await _devToolsLauncher?.ready;
281-
logger.printTrace('test $id: DevTools is being served at ${devToolsServerAddress.uri}');
282-
283-
// Notify the DDS instance that there's a DevTools instance available so it can correctly
284-
// redirect DevTools related requests.
285-
dds?.setExternalDevToolsUri(devToolsServerAddress.uri!);
286-
287-
final Uri devToolsUri = devToolsServerAddress.uri!.replace(
288-
// Use query instead of queryParameters to avoid unnecessary encoding.
289-
query: 'uri=$forwardingUri',
290-
);
291-
logger.printStatus('The Flutter DevTools debugger and profiler is available at: $devToolsUri');
292-
}
293-
294264
/// Binds an [HttpServer] serving from `host` on `port`.
295265
///
296266
/// Only intended to be overridden in tests.

packages/flutter_tools/test/integration.shard/test_test.dart

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void main() {
222222
final Completer<Uri> completer = Completer<Uri>();
223223
final RegExp vmServiceUriRegExp = RegExp(r'((http)?:\/\/)[^\s]+');
224224
sub = process.stdout.transform(utf8.decoder).listen((String e) {
225-
if (!completer.isCompleted && vmServiceUriRegExp.hasMatch(e)) {
225+
if (vmServiceUriRegExp.hasMatch(e)) {
226226
completer.complete(Uri.parse(vmServiceUriRegExp.firstMatch(e)!.group(0)!));
227227
}
228228
});
@@ -237,31 +237,6 @@ void main() {
237237
process.kill();
238238
}
239239
});
240-
241-
testWithoutContext('flutter test should serve DevTools', () async {
242-
late final Process process;
243-
late final StreamSubscription<String> sub;
244-
try {
245-
process = await _runFlutterTestConcurrent('trivial', automatedTestsDirectory, flutterTestDirectory,
246-
extraArguments: const <String>['--start-paused']);
247-
final Completer<Uri> completer = Completer<Uri>();
248-
final RegExp devToolsUriRegExp = RegExp(r'The Flutter DevTools debugger and profiler is available at: (http://[^\s]+)');
249-
sub = process.stdout.transform(utf8.decoder).listen((String e) {
250-
if (!completer.isCompleted && devToolsUriRegExp.hasMatch(e)) {
251-
completer.complete(Uri.parse(devToolsUriRegExp.firstMatch(e)!.group(1)!));
252-
}
253-
});
254-
final Uri devToolsUri = await completer.future;
255-
final HttpClient client = HttpClient();
256-
final HttpClientRequest request = await client.getUrl(devToolsUri);
257-
final HttpClientResponse response = await request.close();
258-
final String content = await response.transform(utf8.decoder).join();
259-
expect(content.contains('DevTools'), true);
260-
} finally {
261-
await sub.cancel();
262-
process.kill();
263-
}
264-
});
265240
}
266241

267242
Future<void> _testFile(

0 commit comments

Comments
 (0)