OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
| 5 |
| 6 library set_library_debuggable_test; |
| 7 |
| 8 import 'dart:developer'; |
| 9 import 'package:observatory/service_io.dart'; |
| 10 import 'package:unittest/unittest.dart'; |
| 11 import 'service_test_common.dart'; |
| 12 import 'test_helper.dart'; |
| 13 |
| 14 const LINE_A = 20; |
| 15 const LINE_B = 21; |
| 16 const LINE_C = 22; |
| 17 |
| 18 testMain() async { |
| 19 debugger(); |
| 20 print('hi'); // LINE_A. |
| 21 print('yep'); // LINE_B. |
| 22 print('zoo'); // LINE_C. |
| 23 } |
| 24 |
| 25 var tests = [ |
| 26 (Isolate isolate) async { |
| 27 await isolate.reload(); |
| 28 Library dartCore = isolate.libraries.firstWhere( |
| 29 (Library library) => library.uri == 'dart:core'); |
| 30 await dartCore.load(); |
| 31 expect(dartCore.debuggable, equals(true)); |
| 32 }, |
| 33 stoppedInFunction('testMain', contains:true), |
| 34 stoppedAtLine(LINE_A), |
| 35 stepInto, |
| 36 stoppedInFunction('print'), |
| 37 stepOut, |
| 38 stoppedInFunction('testMain', contains:true), |
| 39 stoppedAtLine(LINE_B), |
| 40 (Isolate isolate) async { |
| 41 // Mark 'dart:core' as not debuggable. |
| 42 await isolate.reload(); |
| 43 Library dartCore = isolate.libraries.firstWhere( |
| 44 (Library library) => library.uri == 'dart:core'); |
| 45 await dartCore.load(); |
| 46 expect(dartCore.debuggable, equals(true)); |
| 47 var setDebugParams = { |
| 48 'libraryId': dartCore.id, |
| 49 'isDebuggable': false, |
| 50 }; |
| 51 Map<String, dynamic> result = |
| 52 await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', |
| 53 setDebugParams); |
| 54 expect(result['type'], equals('Success')); |
| 55 await dartCore.reload(); |
| 56 expect(dartCore.debuggable, equals(false)); |
| 57 }, |
| 58 stoppedInFunction('testMain', contains:true), |
| 59 stoppedAtLine(LINE_B), |
| 60 stepInto, |
| 61 stoppedInFunction('testMain', contains:true), |
| 62 stoppedAtLine(LINE_C), |
| 63 ]; |
| 64 |
| 65 main(args) async => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |