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

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

Issue 1726773002: Refactor service tests in preparation of running on sky_shell (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:developer'; 6 import 'dart:developer';
7 import 'package:observatory/service_io.dart'; 7 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'service_test_common.dart';
9 import 'test_helper.dart'; 10 import 'test_helper.dart';
10 11
12 const int LINE_A = 19;
13 const int LINE_B = 25;
14
11 foo() {} 15 foo() {}
12 16
13 doAsync(param1) async { 17 doAsync(param1) async {
14 var local1 = param1 + 1; 18 var local1 = param1 + 1;
15 foo(); // Line 15 19 foo(); // Line A.
16 await local1; 20 await local1;
17 } 21 }
18 22
19 doAsyncStar(param2) async* { 23 doAsyncStar(param2) async* {
20 var local2 = param2 + 1; 24 var local2 = param2 + 1;
21 foo(); // Line 21 25 foo(); // Line B.
22 yield local2; 26 yield local2;
23 } 27 }
24 28
25 testeeDo() { 29 testeeDo() {
26 debugger(); 30 debugger();
27 31
28 doAsync(1).then((_) { 32 doAsync(1).then((_) {
29 doAsyncStar(1).listen((_) {}); 33 doAsyncStar(1).listen((_) {});
30 }); 34 });
31 } 35 }
(...skipping 14 matching lines...) Expand all
46 expect(stack.type, equals('Stack')); 50 expect(stack.type, equals('Stack'));
47 expect(stack['frames'].length, greaterThanOrEqualTo(1)); 51 expect(stack['frames'].length, greaterThanOrEqualTo(1));
48 Frame frame = stack['frames'][0]; 52 Frame frame = stack['frames'][0];
49 var vars = frame.variables.map((v) => v['name']).join(' '); 53 var vars = frame.variables.map((v) => v['name']).join(' ');
50 expect(vars, equals('param2 local2')); // no :async_op et al 54 expect(vars, equals('param2 local2')); // no :async_op et al
51 } 55 }
52 56
53 57
54 var tests = [ 58 var tests = [
55 hasStoppedAtBreakpoint, // debugger() 59 hasStoppedAtBreakpoint, // debugger()
56 setBreakpointAtLine(15), 60 setBreakpointAtLine(LINE_A),
57 setBreakpointAtLine(21), 61 setBreakpointAtLine(LINE_B),
58 resumeIsolate, 62 resumeIsolate,
59 63
60 hasStoppedAtBreakpoint, 64 hasStoppedAtBreakpoint,
61 stoppedAtLine(15), 65 stoppedAtLine(LINE_A),
62 checkAsyncVarDescriptors, 66 checkAsyncVarDescriptors,
63 resumeIsolate, 67 resumeIsolate,
64 68
65 hasStoppedAtBreakpoint, 69 hasStoppedAtBreakpoint,
66 stoppedAtLine(21), 70 stoppedAtLine(LINE_B),
67 checkAsyncStarVarDescriptors, 71 checkAsyncStarVarDescriptors,
68 resumeIsolate, 72 resumeIsolate,
69 ]; 73 ];
70 74
71 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo); 75 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698