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

Side by Side Diff: runtime/observatory/tests/service/parameters_in_scope_at_entry_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 --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 'test_helper.dart'; 7 import 'test_helper.dart';
8 import 'dart:developer'; 8 import 'dart:developer';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import 'service_test_common.dart';
12
13 const int LINE_A = 29;
14 const int LINE_B = 33;
15
11 foo(param) { 16 foo(param) {
12 return param; 17 return param;
13 } 18 }
14 19
15 fooClosure() { 20 fooClosure() {
16 theClosureFunction(param) { 21 theClosureFunction(param) {
17 return param; 22 return param;
18 } 23 }
19 return theClosureFunction; 24 return theClosureFunction;
20 } 25 }
21 26
22 testMain() { 27 testMain() {
23 debugger(); 28 debugger();
24 foo("in-scope"); // Line 24 29 foo("in-scope"); // Line A.
25 30
26 var f = fooClosure(); 31 var f = fooClosure();
27 debugger(); 32 debugger();
28 f("in-scope"); // Line 28 33 f("in-scope"); // Line B.
29 } 34 }
30 35
31 var tests = [ 36 var tests = [
32 hasStoppedAtBreakpoint, 37 hasStoppedAtBreakpoint,
33 stoppedAtLine(24), 38 stoppedAtLine(LINE_A),
34 (isolate) => isolate.stepInto(), 39 (isolate) => isolate.stepInto(),
35 hasStoppedAtBreakpoint, 40 hasStoppedAtBreakpoint,
36 (isolate) async { 41 (isolate) async {
37 var stack = await isolate.getStack(); 42 var stack = await isolate.getStack();
38 Frame top = stack['frames'][0]; 43 Frame top = stack['frames'][0];
39 print(top); 44 print(top);
40 expect(top.function.name, equals("foo")); 45 expect(top.function.name, equals("foo"));
41 print(top.variables); 46 print(top.variables);
42 expect(top.variables.length, equals(1)); 47 expect(top.variables.length, equals(1));
43 var param = top.variables[0]; 48 var param = top.variables[0];
44 expect(param['name'], equals("param")); 49 expect(param['name'], equals("param"));
45 expect(param['value'].valueAsString, equals("in-scope")); 50 expect(param['value'].valueAsString, equals("in-scope"));
46 }, 51 },
47 resumeIsolate, 52 resumeIsolate,
48 53
49 hasStoppedAtBreakpoint, 54 hasStoppedAtBreakpoint,
50 stoppedAtLine(28), 55 stoppedAtLine(LINE_B),
51 (isolate) => isolate.stepInto(), 56 (isolate) => isolate.stepInto(),
52 hasStoppedAtBreakpoint, 57 hasStoppedAtBreakpoint,
53 (isolate) async { 58 (isolate) async {
54 var stack = await isolate.getStack(); 59 var stack = await isolate.getStack();
55 Frame top = stack['frames'][0]; 60 Frame top = stack['frames'][0];
56 print(top); 61 print(top);
57 expect(top.function.name, equals("theClosureFunction")); 62 expect(top.function.name, equals("theClosureFunction"));
58 print(top.variables); 63 print(top.variables);
59 expect(top.variables.length, equals(1)); 64 expect(top.variables.length, equals(1));
60 var param = top.variables[0]; 65 var param = top.variables[0];
61 expect(param['name'], equals("param")); 66 expect(param['name'], equals("param"));
62 expect(param['value'].valueAsString, equals("in-scope")); 67 expect(param['value'].valueAsString, equals("in-scope"));
63 }, 68 },
64 resumeIsolate, 69 resumeIsolate,
65 ]; 70 ];
66 71
67 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); 72 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698