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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. Created 3 years, 9 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
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 5
6 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 9
10 printSync() { // Line 10 10 printSync() {
11 // Line 10
11 print('sync'); 12 print('sync');
12 } 13 }
13 printAsync() async { // Line 13 14
15 printAsync() async {
16 // Line 13
14 print('async'); 17 print('async');
15 } 18 }
16 printAsyncStar() async* { // Line 16 19
20 printAsyncStar() async* {
21 // Line 16
17 print('async*'); 22 print('async*');
18 } 23 }
19 printSyncStar() sync* { // Line 19 24
25 printSyncStar() sync* {
26 // Line 19
20 print('sync*'); 27 print('sync*');
21 } 28 }
22 29
23 var testerReady = false; 30 var testerReady = false;
24 testeeDo() { 31 testeeDo() {
25 // We block here rather than allowing the isolate to enter the 32 // We block here rather than allowing the isolate to enter the
26 // paused-on-exit state before the tester gets a chance to set 33 // paused-on-exit state before the tester gets a chance to set
27 // the breakpoints because we need the event loop to remain 34 // the breakpoints because we need the event loop to remain
28 // operational for the async bodies to run. 35 // operational for the async bodies to run.
29 print('testee waiting'); 36 print('testee waiting');
30 while(!testerReady); 37 while (!testerReady);
31 38
32 printSync(); 39 printSync();
33 var future = printAsync(); 40 var future = printAsync();
34 var stream = printAsyncStar(); 41 var stream = printAsyncStar();
35 var iterator = printSyncStar(); 42 var iterator = printSyncStar();
36 43
37 print('middle'); // Line 37. 44 print('middle'); // Line 37.
38 45
39 future.then((v) => print(v)); 46 future.then((v) => print(v));
40 stream.toList(); 47 stream.toList();
41 iterator.toList(); 48 iterator.toList();
42 } 49 }
43 50
44 testAsync(Isolate isolate) async { 51 testAsync(Isolate isolate) async {
45 await isolate.rootLibrary.load(); 52 await isolate.rootLibrary.load();
46 var script = isolate.rootLibrary.scripts[0]; 53 var script = isolate.rootLibrary.scripts[0];
47 54
48 var bp1 = await isolate.addBreakpoint(script, 10); 55 var bp1 = await isolate.addBreakpoint(script, 10);
49 expect(bp1, isNotNull); 56 expect(bp1, isNotNull);
50 expect(bp1 is Breakpoint, isTrue); 57 expect(bp1 is Breakpoint, isTrue);
51 var bp2 = await isolate.addBreakpoint(script, 13); 58 var bp2 = await isolate.addBreakpoint(script, 13);
52 expect(bp2, isNotNull); 59 expect(bp2, isNotNull);
53 expect(bp2 is Breakpoint, isTrue); 60 expect(bp2 is Breakpoint, isTrue);
54 var bp3 = await isolate.addBreakpoint(script, 16); 61 var bp3 = await isolate.addBreakpoint(script, 16);
55 expect(bp3, isNotNull); 62 expect(bp3, isNotNull);
56 expect(bp3 is Breakpoint, isTrue); 63 expect(bp3 is Breakpoint, isTrue);
57 var bp4 = await isolate.addBreakpoint(script, 19); 64 var bp4 = await isolate.addBreakpoint(script, 19);
58 expect(bp4, isNotNull); 65 expect(bp4, isNotNull);
59 expect(bp4 is Breakpoint, isTrue); 66 expect(bp4 is Breakpoint, isTrue);
60 var bp5 = await isolate.addBreakpoint(script, 37); 67 var bp5 = await isolate.addBreakpoint(script, 37);
61 print("BP5 - $bp5"); 68 print("BP5 - $bp5");
62 expect(bp5, isNotNull); 69 expect(bp5, isNotNull);
63 expect(bp5 is Breakpoint, isTrue); 70 expect(bp5 is Breakpoint, isTrue);
64 71
65 var hits = []; 72 var hits = [];
66 73
67 isolate.rootLibrary.evaluate('testerReady = true;') 74 isolate.rootLibrary.evaluate('testerReady = true;').then((Instance result) {
68 .then((Instance result) { 75 expect(result.valueAsString, equals('true'));
69 expect(result.valueAsString, equals('true')); 76 });
70 });
71 77
72 var stream = await isolate.vm.getEventStream(VM.kDebugStream); 78 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
73 await for (ServiceEvent event in stream) { 79 await for (ServiceEvent event in stream) {
74 if (event.kind == ServiceEvent.kPauseBreakpoint) { 80 if (event.kind == ServiceEvent.kPauseBreakpoint) {
75 var bp = event.breakpoint; 81 var bp = event.breakpoint;
76 print('Hit $bp'); 82 print('Hit $bp');
77 hits.add(bp); 83 hits.add(bp);
78 await isolate.resume(); 84 await isolate.resume();
79 85
80 if (hits.length == 5) break; 86 if (hits.length == 5) break;
81 } 87 }
82 } 88 }
83 89
84 expect(hits, equals([bp1, bp5, bp4, bp2, bp3])); 90 expect(hits, equals([bp1, bp5, bp4, bp2, bp3]));
85 } 91 }
86 92
87 var tests = [testAsync]; 93 var tests = [testAsync];
88 94
89 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo); 95 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/allocations_test.dart ('k') | runtime/observatory/tests/service/async_next_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698