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

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

Issue 1241673003: Async-step, first cut. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
(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
5
6 import 'dart:async';
7 import 'dart:developer';
8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart';
11
12 foo() {}
13
14 doAsync(param1) async {
15 var local1 = param1 + 1;
16 foo(); // Line 16
17 await null;
18 }
19
20 doAsyncStar(param2) async* {
21 var local2 = param2 + 1;
22 foo(); // Line 22
23 yield null;
24 }
25
26 testeeDo() {
27 debugger();
28
29 doAsync(1).then((_) {
30 doAsyncStar(1).listen((_) {});
31 });
32 }
33
34
35 checkAsyncVarDescriptors(Isolate isolate) async {
36 ServiceMap stack = await isolate.getStack();
37 expect(stack.type, equals('Stack'));
38 expect(stack['frames'].length, greaterThanOrEqualTo(1));
39 Frame frame = stack['frames'][0];
40 var vars = frame.variables.map((v) => v['name']).join(' ');
41 expect(vars, equals('param1 local1')); // no :async_op et al
42 }
43
44
45 checkAsyncStarVarDescriptors(Isolate isolate) async {
46 ServiceMap stack = await isolate.getStack();
47 expect(stack.type, equals('Stack'));
48 expect(stack['frames'].length, greaterThanOrEqualTo(1));
49 Frame frame = stack['frames'][0];
50 var vars = frame.variables.map((v) => v['name']).join(' ');
51 expect(vars, equals('param2 local2')); // no :async_op et al
52 }
53
54
55 var tests = [
56 hasStoppedAtBreakpoint, // debugger()
57 setBreakpointAtLine(16),
58 setBreakpointAtLine(22),
59 resumeIsolate,
60
61 hasStoppedAtBreakpoint,
62 stoppedAtLine(16),
63 checkAsyncVarDescriptors,
64 resumeIsolate,
65
66 hasStoppedAtBreakpoint,
67 stoppedAtLine(22),
68 checkAsyncStarVarDescriptors,
69 resumeIsolate,
70 ];
71
72 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/async_continuation_test.dart ('k') | runtime/observatory/tests/service/async_step_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698