| // 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. |
| // VMOptions=--verbose_debug |
| |
| import 'package:test/test.dart'; |
| import 'package:vm_service/vm_service.dart'; |
| |
| import 'common/service_test_common.dart'; |
| import 'set_breakpoint_state_lib.dart' as testee_lib; |
| |
| late Breakpoint bpt; |
| |
| void main([args = const <String>[]]) => |
| IsolateTestHarness('set_breakpoint_state_lib.dart', args) |
| .hasPausedAtStart() |
| .addCustomTestWithParser(( |
| VmService service, |
| IsolateRef isolateRef, |
| TestScriptParser parser, |
| ) async { |
| bpt = await service.addBreakpointWithScriptUri( |
| isolateRef.id!, |
| 'set_breakpoint_state_lib.dart', |
| parser.lineForTag('LINE_A'), |
| ); |
| expect(bpt.enabled, true); |
| }) |
| .setBreakpointAtLine('LINE_B') |
| .resumeIsolate() |
| .hasStoppedAtBreakpoint() |
| .stoppedAtLine('LINE_A') |
| .resumeIsolate() |
| .hasStoppedAtBreakpoint() |
| .stoppedAtLine('LINE_B') |
| .addCustomTest((VmService service, IsolateRef isolateRef) async { |
| bpt = await service.setBreakpointState( |
| isolateRef.id!, |
| bpt.id!, |
| false, |
| ); |
| expect(bpt.enabled, false); |
| }) |
| .resumeIsolate() |
| .hasStoppedAtBreakpoint() |
| .stoppedAtLine('LINE_B') |
| .addCustomTest((VmService service, IsolateRef isolateRef) async { |
| bpt = await service.setBreakpointState( |
| isolateRef.id!, |
| bpt.id!, |
| true, |
| ); |
| expect(bpt.enabled, true); |
| }) |
| .resumeIsolate() |
| .hasStoppedAtBreakpoint() |
| .stoppedAtLine('LINE_A') |
| .run(testeeMain: testee_lib.main, pauseOnStart: true); |