Unverified Commit 66d7a6c2 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] update to package vm_service: electric boogaloo (#53809)

parent 365528aa
...@@ -14,9 +14,9 @@ dependencies: ...@@ -14,9 +14,9 @@ dependencies:
test_api: 0.2.15 test_api: 0.2.15
test_core: 0.3.3 test_core: 0.3.3
build_runner: 1.8.0 build_runner: 1.8.1
build_test: 1.0.0 build_test: 1.0.0
build_runner_core: 4.5.3 build_runner_core: 5.0.0
dart_style: 1.3.3 dart_style: 1.3.3
code_builder: 3.2.1 code_builder: 3.2.1
build: 1.2.2 build: 1.2.2
...@@ -95,4 +95,4 @@ dartdoc: ...@@ -95,4 +95,4 @@ dartdoc:
# Exclude this package from the hosted API docs. # Exclude this package from the hosted API docs.
nodoc: true nodoc: true
# PUBSPEC CHECKSUM: e267 # PUBSPEC CHECKSUM: 7c61
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
import 'dart:async'; import 'dart:async';
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:vm_service/vm_service.dart' as vmservice;
import 'asset.dart'; import 'asset.dart';
import 'base/context.dart'; import 'base/context.dart';
...@@ -423,7 +423,7 @@ class DevFS { ...@@ -423,7 +423,7 @@ class DevFS {
globals.printTrace('DevFS: Creating new filesystem on the device ($_baseUri)'); globals.printTrace('DevFS: Creating new filesystem on the device ($_baseUri)');
try { try {
_baseUri = await _operations.create(fsName); _baseUri = await _operations.create(fsName);
} on rpc.RpcException catch (rpcException) { } on vmservice.RPCError catch (rpcException) {
// 1001 is kFileSystemAlreadyExists in //dart/runtime/vm/json_stream.h // 1001 is kFileSystemAlreadyExists in //dart/runtime/vm/json_stream.h
if (rpcException.code != 1001) { if (rpcException.code != 1001) {
rethrow; rethrow;
......
...@@ -620,7 +620,7 @@ class FuchsiaDevice extends Device { ...@@ -620,7 +620,7 @@ class FuchsiaDevice extends Device {
// loopback (::1). // loopback (::1).
final Uri uri = Uri.parse('http://[$_ipv6Loopback]:$port'); final Uri uri = Uri.parse('http://[$_ipv6Loopback]:$port');
final VMService vmService = await VMService.connect(uri); final VMService vmService = await VMService.connect(uri);
await vmService.getVM(); await vmService.getVMOld();
await vmService.refreshViews(); await vmService.refreshViews();
for (final FlutterView flutterView in vmService.vm.views) { for (final FlutterView flutterView in vmService.vm.views) {
if (flutterView.uiIsolate == null) { if (flutterView.uiIsolate == null) {
...@@ -717,7 +717,7 @@ class FuchsiaIsolateDiscoveryProtocol { ...@@ -717,7 +717,7 @@ class FuchsiaIsolateDiscoveryProtocol {
continue; continue;
} }
} }
await service.getVM(); await service.getVMOld();
await service.refreshViews(); await service.refreshViews();
for (final FlutterView flutterView in service.vm.views) { for (final FlutterView flutterView in service.vm.views) {
if (flutterView.uiIsolate == null) { if (flutterView.uiIsolate == null) {
......
...@@ -7,11 +7,11 @@ import 'dart:math' as math; ...@@ -7,11 +7,11 @@ import 'dart:math' as math;
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:platform/platform.dart'; import 'package:platform/platform.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../application_package.dart'; import '../application_package.dart';
import '../artifacts.dart'; import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart'; import '../base/file_system.dart';
import '../base/io.dart'; import '../base/io.dart';
import '../base/logger.dart'; import '../base/logger.dart';
...@@ -514,7 +514,7 @@ class IOSDeviceLogReader extends DeviceLogReader { ...@@ -514,7 +514,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
// and "Flutter". The regex tries to strike a balance between not producing // and "Flutter". The regex tries to strike a balance between not producing
// false positives and not producing false negatives. // false positives and not producing false negatives.
_anyLineRegex = RegExp(r'\w+(\([^)]*\))?\[\d+\] <[A-Za-z]+>: '); _anyLineRegex = RegExp(r'\w+(\([^)]*\))?\[\d+\] <[A-Za-z]+>: ');
_loggingSubscriptions = <StreamSubscription<ServiceEvent>>[]; _loggingSubscriptions = <StreamSubscription<void>>[];
} }
/// Create a new [IOSDeviceLogReader]. /// Create a new [IOSDeviceLogReader].
...@@ -554,7 +554,7 @@ class IOSDeviceLogReader extends DeviceLogReader { ...@@ -554,7 +554,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
RegExp _anyLineRegex; RegExp _anyLineRegex;
StreamController<String> _linesController; StreamController<String> _linesController;
List<StreamSubscription<ServiceEvent>> _loggingSubscriptions; List<StreamSubscription<void>> _loggingSubscriptions;
@override @override
Stream<String> get logLines => _linesController.stream; Stream<String> get logLines => _linesController.stream;
...@@ -575,18 +575,20 @@ class IOSDeviceLogReader extends DeviceLogReader { ...@@ -575,18 +575,20 @@ class IOSDeviceLogReader extends DeviceLogReader {
if (_majorSdkVersion < _minimumUniversalLoggingSdkVersion) { if (_majorSdkVersion < _minimumUniversalLoggingSdkVersion) {
return; return;
} }
// The VM service will not publish logging events unless the debug stream is being listened to. try {
// onDebugEvent listens to this stream as a side effect. await connectedVmService.streamListen('Stdout');
unawaited(connectedVmService.onDebugEvent); } on vm_service.RPCError {
_loggingSubscriptions.add((await connectedVmService.onStdoutEvent).listen((ServiceEvent event) { // Do nothing, since the tool is already subscribed.
final String logMessage = event.message; }
if (logMessage.isNotEmpty) { _loggingSubscriptions.add(connectedVmService.onStdoutEvent.listen((vm_service.Event event) {
_linesController.add(logMessage); final String message = utf8.decode(base64.decode(event.bytes));
if (message.isNotEmpty) {
_linesController.add(message);
} }
})); }));
} }
void _listenToSysLog () { void _listenToSysLog() {
// syslog is not written on iOS 13+. // syslog is not written on iOS 13+.
if (_majorSdkVersion >= _minimumUniversalLoggingSdkVersion) { if (_majorSdkVersion >= _minimumUniversalLoggingSdkVersion) {
return; return;
...@@ -641,7 +643,7 @@ class IOSDeviceLogReader extends DeviceLogReader { ...@@ -641,7 +643,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
@override @override
void dispose() { void dispose() {
for (final StreamSubscription<ServiceEvent> loggingSubscription in _loggingSubscriptions) { for (final StreamSubscription<void> loggingSubscription in _loggingSubscriptions) {
loggingSubscription.cancel(); loggingSubscription.cancel();
} }
_idevicesyslogProcess?.kill(); _idevicesyslogProcess?.kill();
......
...@@ -232,7 +232,7 @@ class FlutterDevice { ...@@ -232,7 +232,7 @@ class FlutterDevice {
: vmService.vm.views).toList(); : vmService.vm.views).toList();
} }
Future<void> getVMs() => vmService.getVM(); Future<void> getVMs() => vmService.getVMOld();
Future<void> exitApps() async { Future<void> exitApps() async {
if (!device.supportsFlutterExit) { if (!device.supportsFlutterExit) {
......
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'package:vm_service/vm_service.dart' as vm_service;
import 'package:platform/platform.dart'; import 'package:platform/platform.dart';
import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:pool/pool.dart'; import 'package:pool/pool.dart';
import 'base/async_guard.dart'; import 'base/async_guard.dart';
...@@ -110,9 +108,10 @@ class HotRunner extends ResidentRunner { ...@@ -110,9 +108,10 @@ class HotRunner extends ResidentRunner {
// TODO(cbernaschina): check that isolateId is the id of the UI isolate. // TODO(cbernaschina): check that isolateId is the id of the UI isolate.
final OperationResult result = await restart(pause: pause); final OperationResult result = await restart(pause: pause);
if (!result.isOk) { if (!result.isOk) {
throw rpc.RpcException( throw vm_service.RPCError(
rpc_error_code.INTERNAL_ERROR,
'Unable to reload sources', 'Unable to reload sources',
RPCErrorCodes.kInternalError,
'',
); );
} }
} }
...@@ -121,9 +120,10 @@ class HotRunner extends ResidentRunner { ...@@ -121,9 +120,10 @@ class HotRunner extends ResidentRunner {
final OperationResult result = final OperationResult result =
await restart(fullRestart: true, pause: pause); await restart(fullRestart: true, pause: pause);
if (!result.isOk) { if (!result.isOk) {
throw rpc.RpcException( throw vm_service.RPCError(
rpc_error_code.INTERNAL_ERROR,
'Unable to restart', 'Unable to restart',
RPCErrorCodes.kInternalError,
'',
); );
} }
} }
...@@ -564,16 +564,15 @@ class HotRunner extends ResidentRunner { ...@@ -564,16 +564,15 @@ class HotRunner extends ResidentRunner {
if (benchmarkMode) { if (benchmarkMode) {
final List<Future<void>> isolateNotifications = <Future<void>>[]; final List<Future<void>> isolateNotifications = <Future<void>>[];
for (final FlutterDevice device in flutterDevices) { for (final FlutterDevice device in flutterDevices) {
try {
await device.vmService.streamListen('Isolate');
} on vm_service.RPCError {
// Do nothing, we're already subcribed.
}
for (final FlutterView view in device.views) { for (final FlutterView view in device.views) {
isolateNotifications.add( isolateNotifications.add(
view.owner.vm.vmService.onIsolateEvent view.owner.vm.vmService.onIsolateEvent.firstWhere((vm_service.Event event) {
.then((Stream<ServiceEvent> serviceEvents) async { return event.kind == vm_service.EventKind.kServiceExtensionAdded;
await for (final ServiceEvent serviceEvent in serviceEvents) {
if (serviceEvent.owner.name.contains('_spawn')
&& serviceEvent.kind == ServiceEvent.kIsolateExit) {
return;
}
}
}), }),
); );
} }
...@@ -720,9 +719,12 @@ class HotRunner extends ResidentRunner { ...@@ -720,9 +719,12 @@ class HotRunner extends ResidentRunner {
if (!result.isOk) { if (!result.isOk) {
restartEvent = 'restart-failed'; restartEvent = 'restart-failed';
} }
} on rpc.RpcException { } on vm_service.SentinelException catch (err, st) {
restartEvent = 'exception';
return OperationResult(1, 'hot restart failed to complete: $err\n$st', fatal: true);
} on vm_service.RPCError catch (err, st) {
restartEvent = 'exception'; restartEvent = 'exception';
return OperationResult(1, 'hot restart failed to complete', fatal: true); return OperationResult(1, 'hot restart failed to complete: $err\n$st', fatal: true);
} finally { } finally {
HotEvent(restartEvent, HotEvent(restartEvent,
targetPlatform: targetPlatform, targetPlatform: targetPlatform,
...@@ -764,7 +766,7 @@ class HotRunner extends ResidentRunner { ...@@ -764,7 +766,7 @@ class HotRunner extends ResidentRunner {
); );
}, },
); );
} on rpc.RpcException { } on vm_service.RPCError {
HotEvent('exception', HotEvent('exception',
targetPlatform: targetPlatform, targetPlatform: targetPlatform,
sdkName: sdkName, sdkName: sdkName,
......
...@@ -189,7 +189,7 @@ Future<Map<String, dynamic>> collect(Uri serviceUri, bool Function(String) libra ...@@ -189,7 +189,7 @@ Future<Map<String, dynamic>> collect(Uri serviceUri, bool Function(String) libra
Future<VMService> Function(Uri) connector = _defaultConnect, Future<VMService> Function(Uri) connector = _defaultConnect,
}) async { }) async {
final VMService vmService = await connector(serviceUri); final VMService vmService = await connector(serviceUri);
await vmService.getVM(); await vmService.getVMOld();
final Map<String, dynamic> result = await _getAllCoverage( final Map<String, dynamic> result = await _getAllCoverage(
vmService, libraryPredicate); vmService, libraryPredicate);
await vmService.close(); await vmService.close();
...@@ -197,7 +197,7 @@ Future<Map<String, dynamic>> collect(Uri serviceUri, bool Function(String) libra ...@@ -197,7 +197,7 @@ Future<Map<String, dynamic>> collect(Uri serviceUri, bool Function(String) libra
} }
Future<Map<String, dynamic>> _getAllCoverage(VMService service, bool Function(String) libraryPredicate) async { Future<Map<String, dynamic>> _getAllCoverage(VMService service, bool Function(String) libraryPredicate) async {
await service.getVM(); await service.getVMOld();
final List<Map<String, dynamic>> coverage = <Map<String, dynamic>>[]; final List<Map<String, dynamic>> coverage = <Map<String, dynamic>>[];
for (final Isolate isolateRef in service.vm.isolates) { for (final Isolate isolateRef in service.vm.isolates) {
await isolateRef.load(); await isolateRef.load();
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'package:vm_service/vm_service.dart' as vm_service;
import 'base/file_system.dart'; import 'base/file_system.dart';
import 'base/logger.dart'; import 'base/logger.dart';
...@@ -45,7 +46,8 @@ class Tracing { ...@@ -45,7 +46,8 @@ class Tracing {
); );
try { try {
final Completer<void> whenFirstFrameRendered = Completer<void>(); final Completer<void> whenFirstFrameRendered = Completer<void>();
(await vmService.onExtensionEvent).listen((ServiceEvent event) { await vmService.streamListen('Extension');
vmService.onExtensionEvent.listen((vm_service.Event event) {
if (event.extensionKind == 'Flutter.FirstFrame') { if (event.extensionKind == 'Flutter.FirstFrame') {
whenFirstFrameRendered.complete(); whenFirstFrameRendered.complete();
} }
......
...@@ -19,7 +19,6 @@ dependencies: ...@@ -19,7 +19,6 @@ dependencies:
flutter_template_images: 1.0.0 flutter_template_images: 1.0.0
http: 0.12.0+4 http: 0.12.0+4
intl: 0.16.1 intl: 0.16.1
json_rpc_2: 2.1.0
meta: 1.1.8 meta: 1.1.8
multicast_dns: 0.2.2 multicast_dns: 0.2.2
mustache_template: 1.0.0+1 mustache_template: 1.0.0+1
...@@ -28,10 +27,8 @@ dependencies: ...@@ -28,10 +27,8 @@ dependencies:
process: 3.0.12 process: 3.0.12
quiver: 2.1.3 quiver: 2.1.3
stack_trace: 1.9.3 stack_trace: 1.9.3
stream_channel: 2.0.0
usage: 3.4.1 usage: 3.4.1
webdriver: 2.1.2 webdriver: 2.1.2
web_socket_channel: 1.1.0
webkit_inspection_protocol: 0.5.0+1 webkit_inspection_protocol: 0.5.0+1
xml: 3.6.1 xml: 3.6.1
yaml: 2.2.0 yaml: 2.2.0
...@@ -88,6 +85,7 @@ dependencies: ...@@ -88,6 +85,7 @@ dependencies:
source_maps: 0.10.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_maps: 0.10.9 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" source_span: 1.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
sse: 3.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" sse: 3.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_transform: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" stream_transform: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" string_scanner: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
sync_http: 0.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" sync_http: 0.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
...@@ -95,6 +93,7 @@ dependencies: ...@@ -95,6 +93,7 @@ dependencies:
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
uuid: 2.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" uuid: 2.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
watcher: 0.9.7+14 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade" watcher: 0.9.7+14 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
web_socket_channel: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies: dev_dependencies:
collection: 1.14.12 collection: 1.14.12
...@@ -112,4 +111,4 @@ dartdoc: ...@@ -112,4 +111,4 @@ dartdoc:
# Exclude this package from the hosted API docs. # Exclude this package from the hosted API docs.
nodoc: true nodoc: true
# PUBSPEC CHECKSUM: 53c2 # PUBSPEC CHECKSUM: a585
...@@ -14,8 +14,8 @@ import 'package:flutter_tools/src/base/net.dart'; ...@@ -14,8 +14,8 @@ import 'package:flutter_tools/src/base/net.dart';
import 'package:flutter_tools/src/compile.dart'; import 'package:flutter_tools/src/compile.dart';
import 'package:flutter_tools/src/devfs.dart'; import 'package:flutter_tools/src/devfs.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
...@@ -389,7 +389,7 @@ class MockVM implements VM { ...@@ -389,7 +389,7 @@ class MockVM implements VM {
Future<Map<String, dynamic>> createDevFS(String fsName) async { Future<Map<String, dynamic>> createDevFS(String fsName) async {
_service.messages.add('create $fsName'); _service.messages.add('create $fsName');
if (_devFSExists) { if (_devFSExists) {
throw rpc.RpcException(kFileSystemAlreadyExists, 'File system already exists'); throw vm_service.RPCError('File system already exists', kFileSystemAlreadyExists, '');
} }
_devFSExists = true; _devFSExists = true;
return <String, dynamic>{'uri': '$_baseUri'}; return <String, dynamic>{'uri': '$_baseUri'};
......
...@@ -596,7 +596,7 @@ void main() { ...@@ -596,7 +596,7 @@ void main() {
.thenAnswer((Invocation invocation) async => <int>[1]); .thenAnswer((Invocation invocation) async => <int>[1]);
when(portForwarder.forward(1)) when(portForwarder.forward(1))
.thenAnswer((Invocation invocation) async => 2); .thenAnswer((Invocation invocation) async => 2);
when(vmService.getVM()) when(vmService.getVMOld())
.thenAnswer((Invocation invocation) => Future<void>.value(null)); .thenAnswer((Invocation invocation) => Future<void>.value(null));
when(vmService.refreshViews()) when(vmService.refreshViews())
.thenAnswer((Invocation invocation) => Future<void>.value(null)); .thenAnswer((Invocation invocation) => Future<void>.value(null));
......
...@@ -2,13 +2,18 @@ ...@@ -2,13 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async';
import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/device.dart';
import 'package:flutter_tools/src/ios/devices.dart'; import 'package:flutter_tools/src/ios/devices.dart';
import 'package:flutter_tools/src/ios/mac.dart'; import 'package:flutter_tools/src/ios/mac.dart';
import 'package:flutter_tools/src/vmservice.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
...@@ -137,6 +142,39 @@ Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt ...@@ -137,6 +142,39 @@ Runner(libsystem_asl.dylib)[297] <Notice>: libMobileGestalt
' with a non-Flutter log message following it.', ' with a non-Flutter log message following it.',
]); ]);
}); });
testWithoutContext('IOSDeviceLogReader can listen to VM Service logs', () async {
final MockVmService vmService = MockVmService();
final DeviceLogReader logReader = IOSDeviceLogReader.test(
useSyslog: false,
iMobileDevice: IMobileDevice(
artifacts: artifacts,
processManager: processManager,
cache: fakeCache,
logger: logger,
),
);
final StreamController<Event> controller = StreamController<Event>();
final Completer<Success> stdoutCompleter = Completer<Success>();
when(vmService.streamListen('Stdout')).thenAnswer((Invocation invocation) {
return stdoutCompleter.future;
});
when(vmService.onStdoutEvent).thenAnswer((Invocation invocation) {
return controller.stream;
});
logReader.connectedVMService = vmService;
stdoutCompleter.complete(Success());
controller.add(Event(
kind: 'Stdout',
timestamp: 0,
bytes: base64.encode(utf8.encode(' This is a message ')),
));
// Wait for stream listeners to fire.
await expectLater(logReader.logLines, emits(' This is a message '));
});
} }
class MockArtifacts extends Mock implements Artifacts {} class MockArtifacts extends Mock implements Artifacts {}
class MockVmService extends Mock implements VMService, VmService {}
...@@ -23,8 +23,8 @@ import 'package:flutter_tools/src/resident_runner.dart'; ...@@ -23,8 +23,8 @@ import 'package:flutter_tools/src/resident_runner.dart';
import 'package:flutter_tools/src/run_cold.dart'; import 'package:flutter_tools/src/run_cold.dart';
import 'package:flutter_tools/src/run_hot.dart'; import 'package:flutter_tools/src/run_hot.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:json_rpc_2/json_rpc_2.dart';
import 'package:mockito/mockito.dart'; import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart' as vm_service;
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
...@@ -222,7 +222,7 @@ void main() { ...@@ -222,7 +222,7 @@ void main() {
pathToReload: anyNamed('pathToReload'), pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'), invalidatedFiles: anyNamed('invalidatedFiles'),
dillOutputPath: anyNamed('dillOutputPath'), dillOutputPath: anyNamed('dillOutputPath'),
)).thenThrow(RpcException(666, 'something bad happened')); )).thenThrow(vm_service.RPCError('something bad happened', 666, ''));
final OperationResult result = await residentRunner.restart(fullRestart: false); final OperationResult result = await residentRunner.restart(fullRestart: false);
expect(result.fatal, true); expect(result.fatal, true);
...@@ -327,7 +327,7 @@ void main() { ...@@ -327,7 +327,7 @@ void main() {
pathToReload: anyNamed('pathToReload'), pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'), invalidatedFiles: anyNamed('invalidatedFiles'),
dillOutputPath: anyNamed('dillOutputPath'), dillOutputPath: anyNamed('dillOutputPath'),
)).thenThrow(RpcException(666, 'something bad happened')); )).thenThrow(vm_service.RPCError('something bad happened', 666, ''));
final OperationResult result = await residentRunner.restart(fullRestart: true); final OperationResult result = await residentRunner.restart(fullRestart: true);
expect(result.fatal, true); expect(result.fatal, true);
......
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