Unverified Commit 558ee42b authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Register expression compiler in flutter test setting. (#23511)

* Register expression compiler in flutter test setting so that debugger expression evaluation is functional there.

* Fix analyzer lints
parent 3f179d80
......@@ -24,6 +24,7 @@ import '../bundle.dart';
import '../compile.dart';
import '../dart/package_map.dart';
import '../globals.dart';
import '../vmservice.dart';
import 'watcher.dart';
/// The timeout we give the test process to connect to the test harness
......@@ -413,6 +414,22 @@ class _FlutterPlatform extends PlatformPlugin {
return remoteChannel;
}
Future<String> _compileExpressionService(String isolateId, String expression,
List<String> definitions, List<String> typeDefinitions,
String libraryUri, String klass, bool isStatic,
) async {
if (compiler == null || compiler.compiler == null) {
throw 'Compiler is not set up properly to compile $expression';
}
final CompilerOutput compilerOutput =
await compiler.compiler.compileExpression(expression, definitions,
typeDefinitions, libraryUri, klass, isStatic);
if (compilerOutput != null && compilerOutput.outputFilename != null) {
return base64.encode(fs.file(compilerOutput.outputFilename).readAsBytesSync());
}
throw 'Failed to compile $expression';
}
Future<_AsyncError> _startTest(
String testPath,
StreamChannel<dynamic> controller,
......@@ -526,6 +543,16 @@ class _FlutterPlatform extends PlatformPlugin {
printTrace('test $ourTestCount: using observatory uri $detectedUri from pid ${process.pid}');
}
processObservatoryUri = detectedUri;
{
printTrace('Connecting to service protocol: $processObservatoryUri');
final Future<VMService> localVmService = VMService.connect(processObservatoryUri,
compileExpression: _compileExpressionService);
localVmService.then((VMService vmservice) {
printTrace('Successfully connected to service protocol: $processObservatoryUri');
});
}
gotProcessObservatoryUri.complete();
watcher?.handleStartedProcess(ProcessEvent(ourTestCount, process, processObservatoryUri));
},
......
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