Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new hot reload case string #130008

Merged
merged 2 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ class FlutterDebugAdapter extends FlutterBaseDebugAdapter with VmServiceInfoFile
switch (request.command) {
case 'hotRestart':
case 'hotReload':
// This convention is for the internal IDE client.
case r'$/hotReload':
final bool isFullRestart = request.command == 'hotRestart';
await _performRestart(isFullRestart, args?.args['reason'] as String?);
sendResponse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,24 @@ void main() {
allowExtras: true,
);

// Repeat the test for hot reload with custom syntax.
final Future<List<String>> customOutputEventsFuture = dap.client.stdoutOutput
// But skip any topLevelFunctions that come before the reload.
.skipWhile((String output) => output.startsWith('topLevelFunction'))
.take(2)
.toList();

await dap.client.customSyntaxHotReload();

expectLines(
(await customOutputEventsFuture).join(),
<Object>[
startsWith('Reloaded'),
'topLevelFunction',
],
allowExtras: true,
);

await dap.client.terminate();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ class DapTestClient {
return custom('hotReload');
}

/// Sends a custom request with custom syntax convention to the debug adapter to trigger a Hot Reload.
Future<Response> customSyntaxHotReload() {
return custom(r'$/hotReload');
}

/// Sends a custom request to the debug adapter to trigger a Hot Restart.
Future<Response> hotRestart() {
return custom('hotRestart');
Expand Down