| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:observatory/service_io.dart'; | 5 import 'package:observatory/service_io.dart'; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'test_helper.dart'; | 7 import 'test_helper.dart'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 int globalVar = 100; | 10 int globalVar = 100; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 var tests = [ | 52 var tests = [ |
| 53 | 53 |
| 54 // Go to breakpoint at line 14. | 54 // Go to breakpoint at line 14. |
| 55 (Isolate isolate) { | 55 (Isolate isolate) { |
| 56 return isolate.rootLib.load().then((_) { | 56 return isolate.rootLib.load().then((_) { |
| 57 // Set up a listener to wait for breakpoint events. | 57 // Set up a listener to wait for breakpoint events. |
| 58 Completer completer = new Completer(); | 58 Completer completer = new Completer(); |
| 59 List events = []; | 59 List events = []; |
| 60 isolate.vm.events.stream.listen((ServiceEvent event) { | 60 isolate.vm.events.stream.listen((ServiceEvent event) { |
| 61 if (event.eventType == 'BreakpointReached') { | 61 if (event.eventType == ServiceEvent.kPauseBreakpoint) { |
| 62 print('Breakpoint reached'); | 62 print('Breakpoint reached'); |
| 63 completer.complete(); | 63 completer.complete(); |
| 64 } | 64 } |
| 65 }); | 65 }); |
| 66 | 66 |
| 67 // Create a timer to set a breakpoint with a short delay. | 67 // Create a timer to set a breakpoint with a short delay. |
| 68 new Timer(new Duration(milliseconds: 2000), () { | 68 new Timer(new Duration(milliseconds: 2000), () { |
| 69 // Add the breakpoint. | 69 // Add the breakpoint. |
| 70 print('Setting breakpoint.'); | 70 print('Setting breakpoint.'); |
| 71 var script = isolate.rootLib.scripts[0]; | 71 var script = isolate.rootLib.scripts[0]; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 expect(coverage['coverage'].length, greaterThan(100)); | 145 expect(coverage['coverage'].length, greaterThan(100)); |
| 146 }); | 146 }); |
| 147 })); | 147 })); |
| 148 return Future.wait(tests); | 148 return Future.wait(tests); |
| 149 }); | 149 }); |
| 150 }, | 150 }, |
| 151 | 151 |
| 152 ]; | 152 ]; |
| 153 | 153 |
| 154 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 154 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
| OLD | NEW |