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 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:async/async.dart'; | 7 import 'package:async/async.dart'; |
8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
9 import 'package:vm_service_client/vm_service_client.dart'; | 9 import 'package:vm_service_client/vm_service_client.dart'; |
10 | 10 |
11 import 'utils.dart'; | 11 import 'utils.dart'; |
12 | 12 |
13 VMServiceClient client; | 13 VMServiceClient client; |
14 | 14 |
15 void main() { | 15 void main() { |
16 tearDown(() { | 16 tearDown(() { |
17 if (client != null) client.close(); | 17 if (client != null) client.close(); |
18 }); | 18 }); |
19 | 19 |
20 test("includes the breakpoint's metadata", () async { | 20 test("includes the breakpoint's metadata", () async { |
21 client = await runAndConnect(main: r""" | 21 client = await runAndConnect(main: r""" |
22 print("one"); | 22 print("one"); |
23 print("two"); // line 9 | 23 print("two"); // line 9 |
24 """, flags: ["--pause-isolates-on-start"]); | 24 """, flags: ["--pause-isolates-on-start"]); |
25 | 25 |
26 var isolate = (await client.getVM()).isolates.first; | 26 var isolate = (await client.getVM()).isolates.first; |
27 | 27 |
28 var stdout = new StreamQueue(lines.bind(isolate.stdout)); | 28 var stdout = new StreamQueue(isolate.stdout.transform(lines)); |
nweiz
2016/04/29 00:52:44
Why are you making these changes in this CL?
kevmoo
2016/04/29 23:36:55
Acknowledged.
| |
29 var line1 = new ResultFuture(stdout.next); | 29 var line1 = new ResultFuture(stdout.next); |
30 var line2 = new ResultFuture(stdout.next.catchError((_) {})); | 30 var line2 = new ResultFuture(stdout.next.catchError((_) {})); |
31 | 31 |
32 await isolate.waitUntilPaused(); | 32 await isolate.waitUntilPaused(); |
33 var library = await (await isolate.load()).rootLibrary.load(); | 33 var library = await (await isolate.load()).rootLibrary.load(); |
34 var breakpoint = await library.scripts.single.addBreakpoint(9); | 34 var breakpoint = await library.scripts.single.addBreakpoint(9); |
35 expect(breakpoint.number, equals(1)); | 35 expect(breakpoint.number, equals(1)); |
36 expect(breakpoint, isNot(new isInstanceOf<VMResolvedBreakpoint>())); | 36 expect(breakpoint, isNot(new isInstanceOf<VMResolvedBreakpoint>())); |
37 expect(breakpoint.location, | 37 expect(breakpoint.location, |
38 new isInstanceOf<VMUnresolvedSourceLocation>()); | 38 new isInstanceOf<VMUnresolvedSourceLocation>()); |
(...skipping 18 matching lines...) Expand all Loading... | |
57 }); | 57 }); |
58 | 58 |
59 test("removes the breakpoint when remove() is called", () async { | 59 test("removes the breakpoint when remove() is called", () async { |
60 client = await runAndConnect(main: r""" | 60 client = await runAndConnect(main: r""" |
61 print("one"); | 61 print("one"); |
62 print("two"); // line 9 | 62 print("two"); // line 9 |
63 """, flags: ["--pause-isolates-on-start"]); | 63 """, flags: ["--pause-isolates-on-start"]); |
64 | 64 |
65 var isolate = (await client.getVM()).isolates.first; | 65 var isolate = (await client.getVM()).isolates.first; |
66 | 66 |
67 var stdout = new StreamQueue(lines.bind(isolate.stdout)); | 67 var stdout = new StreamQueue(isolate.stdout.transform(lines)); |
68 expect(stdout.next, completion(equals("one"))); | 68 expect(stdout.next, completion(equals("one"))); |
69 expect(stdout.next, completion(equals("two"))); | 69 expect(stdout.next, completion(equals("two"))); |
70 | 70 |
71 await isolate.waitUntilPaused(); | 71 await isolate.waitUntilPaused(); |
72 var library = await (await isolate.load()).rootLibrary.load(); | 72 var library = await (await isolate.load()).rootLibrary.load(); |
73 var breakpoint = await library.scripts.single.addBreakpoint(9); | 73 var breakpoint = await library.scripts.single.addBreakpoint(9); |
74 expect(breakpoint.number, equals(1)); | 74 expect(breakpoint.number, equals(1)); |
75 expect(breakpoint, isNot(new isInstanceOf<VMResolvedBreakpoint>())); | 75 expect(breakpoint, isNot(new isInstanceOf<VMResolvedBreakpoint>())); |
76 expect(breakpoint.location, | 76 expect(breakpoint.location, |
77 new isInstanceOf<VMUnresolvedSourceLocation>()); | 77 new isInstanceOf<VMUnresolvedSourceLocation>()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 expect(breakpoint.location, | 202 expect(breakpoint.location, |
203 new isInstanceOf<VMUnresolvedSourceLocation>()); | 203 new isInstanceOf<VMUnresolvedSourceLocation>()); |
204 | 204 |
205 await isolate.resume(); | 205 await isolate.resume(); |
206 await isolate.waitUntilPaused(); | 206 await isolate.waitUntilPaused(); |
207 var resolved = await breakpoint.loadResolved(); | 207 var resolved = await breakpoint.loadResolved(); |
208 expect(resolved, new isInstanceOf<VMResolvedBreakpoint>()); | 208 expect(resolved, new isInstanceOf<VMResolvedBreakpoint>()); |
209 expect(resolved.location, new isInstanceOf<VMSourceLocation>()); | 209 expect(resolved.location, new isInstanceOf<VMSourceLocation>()); |
210 }); | 210 }); |
211 } | 211 } |
OLD | NEW |