Unpin DDS and roll pub packages (#147925)

DDS was temporarily pinned to 4.1.0 because 4.2.0 triggered some test
failures (see https://github.com/flutter/flutter/pull/147250). Those
failures should be fixed by vm_service 14.2.2, so this unpins DDS and
rolls both of these packages (along with devtools_shared, which is a DDS
dependency).

(If the bot updates vm_service before this is done, I can rebase over
that will reduce the size of this PR to just a few files)
This commit is contained in:
Danny Tuppeny
2024-05-08 10:35:28 +01:00
committed by GitHub
parent 86a2613cee
commit cea1d6f055
66 changed files with 181 additions and 214 deletions

View File

@@ -166,102 +166,69 @@ void main() {
});
testWithoutContext('setAssetDirectory forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
final MockVMService mockVMService = MockVMService();
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
unawaited(flutterVmService.setAssetDirectory(
await flutterVmService.setAssetDirectory(
assetsDirectory: Uri(path: 'abc', scheme: 'file'),
viewId: 'abc',
uiIsolateId: 'def',
windows: false,
));
);
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
containsPair('assetDirectory', '/abc'),
containsPair('isolateId', 'def'),
])),
]));
final ({Map<String, Object?>? args, String? isolateId}) call = mockVMService.calledMethods[kSetAssetBundlePathMethod]!.single;
expect(call.isolateId, 'def');
expect(call.args, <String, String>{
'viewId': 'abc',
'assetDirectory': '/abc',
});
});
testWithoutContext('setAssetDirectory forwards arguments correctly - windows', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
unawaited(flutterVmService.setAssetDirectory(
final MockVMService mockVMService = MockVMService();
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
await flutterVmService.setAssetDirectory(
assetsDirectory: Uri(path: 'C:/Users/Tester/AppData/Local/Temp/hello_worldb42a6da5/hello_world/build/flutter_assets', scheme: 'file'),
viewId: 'abc',
uiIsolateId: 'def',
// If windows is not set to `true`, then the file path below is incorrectly prepended with a `/` which
// causes the engine asset manager to interpret the file scheme as invalid.
windows: true,
));
);
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kSetAssetBundlePathMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
containsPair('assetDirectory', r'C:\Users\Tester\AppData\Local\Temp\hello_worldb42a6da5\hello_world\build\flutter_assets'),
containsPair('isolateId', 'def'),
])),
]));
final ({Map<String, Object?>? args, String? isolateId}) call = mockVMService.calledMethods[kSetAssetBundlePathMethod]!.single;
expect(call.isolateId, 'def');
expect(call.args, <String, String>{
'viewId': 'abc',
'assetDirectory': r'C:\Users\Tester\AppData\Local\Temp\hello_worldb42a6da5\hello_world\build\flutter_assets',
});
});
testWithoutContext('getSkSLs forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
final MockVMService mockVMService = MockVMService();
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
unawaited(flutterVmService.getSkSLs(
viewId: 'abc',
));
await flutterVmService.getSkSLs(viewId: 'abc');
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kGetSkSLsMethod),
containsPair('params', allOf(<Matcher>[
containsPair('viewId', 'abc'),
])),
]));
final ({Map<String, Object?>? args, String? isolateId}) call = mockVMService.calledMethods[kGetSkSLsMethod]!.single;
expect(call.isolateId, isNull);
expect(call.args, <String, String>{
'viewId': 'abc',
});
});
testWithoutContext('flushUIThreadTasks forwards arguments correctly', () async {
final Completer<String> completer = Completer<String>();
final vm_service.VmService vmService = vm_service.VmService(
const Stream<String>.empty(),
completer.complete,
);
final FlutterVmService flutterVmService = FlutterVmService(vmService);
final MockVMService mockVMService = MockVMService();
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
unawaited(flutterVmService.flushUIThreadTasks(
uiIsolateId: 'def',
));
await flutterVmService.flushUIThreadTasks(uiIsolateId: 'def');
final Map<String, Object?>? rawRequest = json.decode(await completer.future) as Map<String, Object?>?;
expect(rawRequest, allOf(<Matcher>[
containsPair('method', kFlushUIThreadTasksMethod),
containsPair('params', allOf(<Matcher>[
containsPair('isolateId', 'def'),
])),
]));
final ({Map<String, Object?>? args, String? isolateId}) call = mockVMService.calledMethods[kFlushUIThreadTasksMethod]!.single;
expect(call.isolateId, isNull);
expect(call.args, <String, String>{
'isolateId': 'def',
});
});
testWithoutContext('runInView forwards arguments correctly', () async {
@@ -851,9 +818,18 @@ void main() {
class MockVMService extends Fake implements vm_service.VmService {
final Map<String, String> services = <String, String>{};
final Map<String, vm_service.ServiceCallback> serviceCallBacks = <String, vm_service.ServiceCallback>{};
final Map<String, List<({ String? isolateId, Map<String, Object?>? args})>> calledMethods = <String, List<({Map<String, Object?>? args, String? isolateId})>>{};
final Set<String> listenedStreams = <String>{};
bool errorOnRegisterService = false;
@override
Future<vm_service.Response> callMethod(String method, {String? isolateId, Map<String, Object?>? args}) async {
calledMethods
.putIfAbsent(method, () => <({Map<String, Object?>? args, String? isolateId})>[])
.add((isolateId: isolateId, args: args));
return vm_service.Success();
}
@override
void registerServiceCallback(String service, vm_service.ServiceCallback cb) {
serviceCallBacks[service] = cb;

View File

@@ -464,8 +464,11 @@ The relevant error-causing widget was:
// Launch the app and wait for it to stop at an exception.
late int originalThreadId, newThreadId;
await Future.wait(<Future<void>>[
// Capture the thread ID of the stopped thread.
dap.client.stoppedEvents.first.then((StoppedEventBody event) => originalThreadId = event.threadId!),
// Capture the thread ID of thread when it stops on the exception
// (ignoring the stop on entry that occurs during thread start).
dap.client.stoppedEvents
.where((StoppedEventBody event) => event.reason == 'exception').first
.then((StoppedEventBody event) => originalThreadId = event.threadId!),
dap.client.start(
exceptionPauseMode: 'All', // Ensure we stop on all exceptions
launch: () => dap.client.launch(
@@ -478,8 +481,11 @@ The relevant error-causing widget was:
// Hot restart, ensuring it completes and capturing the ID of the new thread
// to pause.
await Future.wait(<Future<void>>[
// Capture the thread ID of the newly stopped thread.
dap.client.stoppedEvents.first.then((StoppedEventBody event) => newThreadId = event.threadId!),
// Capture the thread ID of the next stop on exception (ignoring any
// stop on exit/entry that occurs during thread start/exit).
dap.client.stoppedEvents
.where((StoppedEventBody event) => event.reason == 'exception').first
.then((StoppedEventBody event) => newThreadId = event.threadId!),
dap.client.hotRestart(),
], eagerError: true);

View File

@@ -67,13 +67,6 @@ class DapTestClient {
/// Returns a stream of the string output from [OutputEventBody] events with the category 'stdout'.
Stream<String> get stdoutOutput => outputEvents
.where((OutputEventBody output) => output.category == 'stdout')
// Skip empty output events. These are pointless (but harmless) events
// that started occurring with pkg:dds 4.2.0 because of how the stack
// trace parsing is done. This will be unnecessary once fixed in
// DDS/DAP.
// TODO(dantup): Remove this once we're updated to a version of DAP that
// includes https://dart-review.googlesource.com/c/sdk/+/364340.
.where((OutputEventBody output) => output.output.isNotEmpty)
.map((OutputEventBody output) => output.output);
/// Sends a custom request to the server and waits for a response.