Skip to content

Commit 6759806

Browse files
committed
Address review comments
1 parent a4b9ff9 commit 6759806

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

dwds/lib/src/services/chrome_proxy_service.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,8 @@ class ChromeProxyService implements VmServiceInterface {
301301
/// with [destroyIsolate] and recreated with this method there is a hot
302302
/// restart or full page refresh.
303303
///
304-
/// If [newConnection] is true, does not recompute metadata information as
305-
/// that is done only when we recreate the isolate the connection as source
306-
/// data may have changed.
304+
/// If [newConnection] is true, this method does not recompute metadata
305+
/// information as the metadata couldn't have changed.
307306
Future<void> createIsolate(
308307
AppConnection appConnection, {
309308
bool newConnection = false,

dwds/test/common/hot_restart_common.dart

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

dwds/test/hot_restart_breakpoints_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void main() {
212212
expect(consoleLogs.contains(newLog), true);
213213
});
214214

215-
test('add adding line, hot restart, removing line, and hot restart, '
215+
test('after adding line, hot restart, removing line, and hot restart, '
216216
'breakpoint is correct across both hot restarts', () async {
217217
final genLog = 'main gen0';
218218

0 commit comments

Comments
 (0)