@@ -378,6 +378,43 @@ void runTests({
378378 expect (source.contains (newString), isTrue);
379379 });
380380
381+ test ('can hot restart while paused' , () async {
382+ final client = context.debugConnection.vmService;
383+ var vm = await client.getVM ();
384+ var isolateId = vm.isolates! .first.id! ;
385+ await client.streamListen ('Debug' );
386+ final stream = client.onEvent ('Debug' );
387+ final scriptList = await client.getScripts (isolateId);
388+ final main = scriptList.scripts! .firstWhere (
389+ (script) => script.uri! .contains ('main.dart' ),
390+ );
391+ final bpLine = await context.findBreakpointLine (
392+ 'printCount' ,
393+ isolateId,
394+ main,
395+ );
396+ await client.addBreakpoint (isolateId, main.id! , bpLine);
397+ await stream.firstWhere (
398+ (event) => event.kind == EventKind .kPauseBreakpoint,
399+ );
400+
401+ await makeEditAndRecompile ();
402+ final hotRestart = context.getRegisteredServiceExtension ('hotRestart' );
403+ await fakeClient.callServiceExtension (hotRestart! );
404+ final source = await context.webDriver.pageSource;
405+
406+ // Main is re-invoked which shouldn't clear the state.
407+ expect (source.contains (originalString), isTrue);
408+ expect (source.contains (newString), isTrue);
409+
410+ vm = await client.getVM ();
411+ isolateId = vm.isolates! .first.id! ;
412+ final isolate = await client.getIsolate (isolateId);
413+
414+ // Previous breakpoint should be cleared.
415+ expect (isolate.breakpoints! .isEmpty, isTrue);
416+ });
417+
381418 test ('can evaluate expressions after hot restart' , () async {
382419 final client = context.debugConnection.vmService;
383420
0 commit comments