Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: runtime/observatory/tests/service/async_generator_breakpoint_test.dart

Issue 2786503003: Fix a couple of bugs with async stack traces (Closed)
Patch Set: update dartk service test status Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/observatory/tests/service/regress_28443_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug
5 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug --stack trace-every=55 --stress-async-stacks
5 6
6 import 'package:observatory/service_io.dart'; 7 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart'; 9 import 'test_helper.dart';
9 10
10 printSync() { 11 printSync() {
11 print('sync'); // Line 11 12 print('sync'); // Line 11
12 } 13 }
13 14
14 printAsync() async { 15 printAsync() async {
(...skipping 15 matching lines...) Expand all
30 // the breakpoints because we need the event loop to remain 31 // the breakpoints because we need the event loop to remain
31 // operational for the async bodies to run. 32 // operational for the async bodies to run.
32 print('testee waiting'); 33 print('testee waiting');
33 while (!testerReady); 34 while (!testerReady);
34 35
35 printSync(); 36 printSync();
36 var future = printAsync(); 37 var future = printAsync();
37 var stream = printAsyncStar(); 38 var stream = printAsyncStar();
38 var iterator = printSyncStar(); 39 var iterator = printSyncStar();
39 40
40 print('middle'); // Line 40 41 print('middle'); // Line 41
41 42
42 future.then((v) => print(v)); 43 future.then((v) => print(v));
43 stream.toList(); 44 stream.toList();
44 iterator.toList(); 45 iterator.toList();
45 } 46 }
46 47
47 testAsync(Isolate isolate) async { 48 testAsync(Isolate isolate) async {
48 await isolate.rootLibrary.load(); 49 await isolate.rootLibrary.load();
49 var script = isolate.rootLibrary.scripts[0]; 50 var script = isolate.rootLibrary.scripts[0];
50 51
51 var bp1 = await isolate.addBreakpoint(script, 11); 52 var bp1 = await isolate.addBreakpoint(script, 11);
52 expect(bp1, isNotNull); 53 expect(bp1, isNotNull);
53 expect(bp1 is Breakpoint, isTrue); 54 expect(bp1 is Breakpoint, isTrue);
54 var bp2 = await isolate.addBreakpoint(script, 15); 55 var bp2 = await isolate.addBreakpoint(script, 15);
55 expect(bp2, isNotNull); 56 expect(bp2, isNotNull);
56 expect(bp2 is Breakpoint, isTrue); 57 expect(bp2 is Breakpoint, isTrue);
57 var bp3 = await isolate.addBreakpoint(script, 19); 58 var bp3 = await isolate.addBreakpoint(script, 19);
58 expect(bp3, isNotNull); 59 expect(bp3, isNotNull);
59 expect(bp3 is Breakpoint, isTrue); 60 expect(bp3 is Breakpoint, isTrue);
60 var bp4 = await isolate.addBreakpoint(script, 23); 61 var bp4 = await isolate.addBreakpoint(script, 23);
61 expect(bp4, isNotNull); 62 expect(bp4, isNotNull);
62 expect(bp4 is Breakpoint, isTrue); 63 expect(bp4 is Breakpoint, isTrue);
63 var bp5 = await isolate.addBreakpoint(script, 40); 64 var bp5 = await isolate.addBreakpoint(script, 41);
64 print("BP5 - $bp5"); 65 print("BP5 - $bp5");
65 expect(bp5, isNotNull); 66 expect(bp5, isNotNull);
66 expect(bp5 is Breakpoint, isTrue); 67 expect(bp5 is Breakpoint, isTrue);
67 68
68 var hits = []; 69 var hits = [];
69 70
70 isolate.rootLibrary.evaluate('testerReady = true;').then((Instance result) { 71 isolate.rootLibrary.evaluate('testerReady = true;').then((Instance result) {
71 expect(result.valueAsString, equals('true')); 72 expect(result.valueAsString, equals('true'));
72 }); 73 });
73 74
74 var stream = await isolate.vm.getEventStream(VM.kDebugStream); 75 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
75 await for (ServiceEvent event in stream) { 76 await for (ServiceEvent event in stream) {
76 if (event.kind == ServiceEvent.kPauseBreakpoint) { 77 if (event.kind == ServiceEvent.kPauseBreakpoint) {
77 var bp = event.breakpoint; 78 var bp = event.breakpoint;
78 print('Hit $bp'); 79 print('Hit $bp');
79 hits.add(bp); 80 hits.add(bp);
80 await isolate.resume(); 81 await isolate.resume();
81 82
82 if (hits.length == 5) break; 83 if (hits.length == 5) break;
83 } 84 }
84 } 85 }
85 86
86 expect(hits, equals([bp1, bp5, bp4, bp2, bp3])); 87 expect(hits, equals([bp1, bp5, bp4, bp2, bp3]));
87 } 88 }
88 89
89 var tests = [testAsync]; 90 var tests = [testAsync];
90 91
91 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo); 92 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/tests/service/regress_28443_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698