[flutter_tools] add vm service method to pull SkSL (#57813)
This commit is contained in:
@@ -678,6 +678,7 @@ VMServiceConnector getFakeVmServiceFactory({
|
||||
Restart restart,
|
||||
CompileExpression compileExpression,
|
||||
ReloadMethod reloadMethod,
|
||||
GetSkSLMethod getSkSLMethod,
|
||||
CompressionOptions compression,
|
||||
Device device,
|
||||
}) async {
|
||||
|
||||
@@ -184,6 +184,7 @@ class TestFlutterDevice extends FlutterDevice {
|
||||
Restart restart,
|
||||
CompileExpression compileExpression,
|
||||
ReloadMethod reloadMethod,
|
||||
GetSkSLMethod getSkSLMethod,
|
||||
}) async {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@@ -541,6 +541,7 @@ class TestFlutterDevice extends FlutterDevice {
|
||||
Restart restart,
|
||||
CompileExpression compileExpression,
|
||||
ReloadMethod reloadMethod,
|
||||
GetSkSLMethod getSkSLMethod,
|
||||
}) async {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user