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

Side by Side Diff: runtime/observatory/test/async_generator_breakpoint_test.dart

Issue 1071363002: Relocate service library tests and hookup a working status file (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --checked --verbose-debug
5
6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart';
9
10 printSync() { // Line 10
11 print('sync');
12 }
13 printAsync() async { // Line 13
14 print('async');
15 }
16 printAsyncStar() async* { // Line 16
17 print('async*');
18 }
19 printSyncStar() sync* { // Line 19
20 print('sync*');
21 }
22
23 var testerReady = false;
24 testeeDo() {
25 // We block here rather than allowing the isolate to enter the
26 // paused-on-exit state before the tester gets a chance to set
27 // the breakpoints because we need the event loop to remain
28 // operational for the async bodies to run.
29 print('testee waiting');
30 while(!testerReady);
31
32 printSync();
33 var future = printAsync();
34 var stream = printAsyncStar();
35 var iterator = printSyncStar();
36
37 print('middle'); // Line 37.
38
39 future.then((v) => print(v));
40 stream.toList();
41 iterator.toList();
42 }
43
44 testAsync(Isolate isolate) async {
45 await isolate.rootLib.load();
46 var script = isolate.rootLib.scripts[0];
47
48 var bp1 = await isolate.addBreakpoint(script, 10);
49 expect(bp1, isNotNull);
50 expect(bp1 is Breakpoint, isTrue);
51 var bp2 = await isolate.addBreakpoint(script, 13);
52 expect(bp2, isNotNull);
53 expect(bp2 is Breakpoint, isTrue);
54 var bp3 = await isolate.addBreakpoint(script, 16);
55 expect(bp3, isNotNull);
56 expect(bp3 is Breakpoint, isTrue);
57 var bp4 = await isolate.addBreakpoint(script, 19);
58 expect(bp4, isNotNull);
59 expect(bp4 is Breakpoint, isTrue);
60 var bp5 = await isolate.addBreakpoint(script, 37);
61 print("BP5 - $bp5");
62 expect(bp5, isNotNull);
63 expect(bp5 is Breakpoint, isTrue);
64
65 var hits = [];
66
67 isolate.eval(isolate.rootLib, 'testerReady = true;')
68 .then((Instance result) {
69 expect(result.valueAsString, equals('true'));
70 });
71
72 await for (ServiceEvent event in isolate.vm.events.stream) {
73 if (event.eventType == ServiceEvent.kPauseBreakpoint) {
74 var bp = event.breakpoint;
75 print('Hit $bp');
76 hits.add(bp);
77 isolate.resume();
78
79 if (hits.length == 5) break;
80 }
81 }
82
83 expect(hits, equals([bp1, bp5, bp4, bp2, bp3]));
84 }
85
86 var tests = [testAsync];
87
88 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
OLDNEW
« no previous file with comments | « runtime/observatory/test/allocations_test.dart ('k') | runtime/observatory/test/bad_web_socket_address_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698