[flutter_tools] reland migrate FlutterViews to package:vm_service (#55797)

Move FlutterView and related RPCs to the package:vm_service implementation. Update some getIsolate calls with catchError to match previous behavior.

- Updates tests that were previously mocking FlutterViews to use real views
- Moves the FlutterView cache from VM to FlutterDevice
- Catch SentinelException during Isolate.kill
This commit is contained in:
Jonah Williams
2020-04-27 17:41:42 -07:00
committed by GitHub
parent 5cc87a5ea5
commit ffcf1db3ca
13 changed files with 565 additions and 368 deletions

View File

@@ -242,6 +242,11 @@ class FakeVmServiceHost {
.having((Map<String, Object> request) => request['id'], 'id', fakeRequest.id)
.having((Map<String, Object> request) => request['params'], 'args', fakeRequest.args)
);
if (fakeRequest.close) {
_vmService.dispose();
expect(_requests, isEmpty);
return;
}
if (fakeRequest.errorCode == null) {
_input.add(json.encode(<String, Object>{
'jsonrpc': '2.0',
@@ -298,11 +303,15 @@ class FakeVmServiceRequest implements VmServiceExpectation {
@required this.args,
this.jsonResponse,
this.errorCode,
this.close = false,
});
final String method;
final String id;
/// When true, the vm service is automatically closed.
final bool close;
/// If non-null, the error code for a [vm_service.RPCError] in place of a
/// standard response.
final int errorCode;