blob: 575530c90da9dbb69125e120a48c9654d8bba426 [file] [log] [blame]
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/test_helper.dart';
void testMain() {
print('Hello world!');
Future<bool> shouldPauseOnExit(VmService service, IsolateRef isolateRef) async {
final isolate = await service.getIsolate(!);
return isolate.pauseOnExit!;
final tests = <IsolateTest>[
(VmService service, IsolateRef isolateRef) async {
await service.setIsolatePauseMode(!, shouldPauseOnExit: false);
expect(await shouldPauseOnExit(service, isolateRef), false);
final completer = Completer<void>();
final stream = service.onDebugEvent;
final subscription = stream.listen((Event event) {
if (event.kind == EventKind.kPauseExit) {
await service.streamListen(EventStreams.kDebug);
await service.setIsolatePauseMode(!, shouldPauseOnExit: true);
expect(await shouldPauseOnExit(service, isolateRef), true);
await service.resume(!);
await completer.future;
await service.resume(!);
await subscription.cancel();
void main([args = const <String>[]]) => runIsolateTests(
pause_on_start: true,
pause_on_exit: true,
testeeConcurrent: testMain,