[flutter_tools] add vm service method to pull SkSL (#57813)

This commit is contained in:
Jonah Williams
2020-05-27 10:10:41 -07:00
committed by GitHub
parent f640ad6914
commit 600338286f
10 changed files with 69 additions and 3 deletions

View File

@@ -678,6 +678,7 @@ VMServiceConnector getFakeVmServiceFactory({
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
CompressionOptions compression,
Device device,
}) async {

View File

@@ -184,6 +184,7 @@ class TestFlutterDevice extends FlutterDevice {
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
}) async {
throw exception;
}

View File

@@ -541,6 +541,7 @@ class TestFlutterDevice extends FlutterDevice {
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
}) async {
throw exception;
}

View File

@@ -144,6 +144,7 @@ void main() {
reloadSources: anyNamed('reloadSources'),
restart: anyNamed('restart'),
compileExpression: anyNamed('compileExpression'),
getSkSLMethod: anyNamed('getSkSLMethod'),
)).thenAnswer((Invocation invocation) async { });
when(mockFlutterDevice.setupDevFS(any, any, packagesFilePath: anyNamed('packagesFilePath')))
.thenAnswer((Invocation invocation) async {
@@ -1191,6 +1192,7 @@ void main() {
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
io.CompressionOptions compression,
Device device,
}) async => mockVMService,

View File

@@ -103,6 +103,7 @@ void main() {
null,
null,
null,
null,
mockVMService,
);
@@ -121,6 +122,7 @@ void main() {
null,
null,
reloadMethod,
null,
mockVMService,
);
@@ -139,6 +141,7 @@ void main() {
null,
mockDevice,
null,
null,
mockVMService,
);
@@ -147,6 +150,23 @@ void main() {
Logger: () => BufferLogger.test()
});
testUsingContext('VmService registers flutterGetSkSL service', () async {
final MockVMService mockVMService = MockVMService();
setUpVmService(
null,
null,
null,
null,
null,
() async => 'hello',
mockVMService,
);
verify(mockVMService.registerService('flutterGetSkSL', 'Flutter Tools')).called(1);
}, overrides: <Type, Generator>{
Logger: () => BufferLogger.test()
});
testUsingContext('VMService returns correct FlutterVersion', () async {
final MockVMService mockVMService = MockVMService();
setUpVmService(
@@ -155,6 +175,7 @@ void main() {
null,
null,
null,
null,
mockVMService,
);

View File

@@ -82,6 +82,12 @@ void main() {
expect(response, throwsA(const TypeMatcher<RPCError>()));
});
test('flutterGetSkSL can be called', () async {
final Response response = await vmService.callMethod('s0.flutterGetSkSL');
expect(response.type, 'Success');
});
// TODO(devoncarew): These tests fail on cirrus-ci windows.
}, skip: Platform.isWindows);
}