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

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

Issue 2690683002: Improvements to causal async stack traces (Closed)
Patch Set: asiva review and rmacnak added on test cases Created 3 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 'dart:developer'; 6 import 'dart:developer';
7 import 'package:observatory/models.dart' as M; 7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'service_test_common.dart'; 10 import 'service_test_common.dart';
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 var tests = [ 36 var tests = [
37 hasStoppedAtBreakpoint, 37 hasStoppedAtBreakpoint,
38 stoppedAtLine(LINE_A), 38 stoppedAtLine(LINE_A),
39 (Isolate isolate) async { 39 (Isolate isolate) async {
40 ServiceMap stack = await isolate.getStack(); 40 ServiceMap stack = await isolate.getStack();
41 // No causal frames because we are in a completely synchronous stack. 41 // No causal frames because we are in a completely synchronous stack.
42 expect(stack['asyncCausalFrames'], isNotNull); 42 expect(stack['asyncCausalFrames'], isNotNull);
43 var asyncStack = stack['asyncCausalFrames']; 43 var asyncStack = stack['asyncCausalFrames'];
44 expect(asyncStack[0].toString(), contains('helper_async_body')); 44 expect(asyncStack[0].toString(), contains('helper'));
45 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); 45 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker));
46 expect(asyncStack[2].toString(), contains('helper')); 46 expect(asyncStack[2].toString(), contains('testMain'));
47 }, 47 },
48 resumeIsolate, 48 resumeIsolate,
49 hasStoppedAtBreakpoint, 49 hasStoppedAtBreakpoint,
50 stoppedAtLine(LINE_B), 50 stoppedAtLine(LINE_B),
51 51
52 (Isolate isolate) async { 52 (Isolate isolate) async {
53 ServiceMap stack = await isolate.getStack(); 53 ServiceMap stack = await isolate.getStack();
54 // Has causal frames (we are inside an async function) 54 // Has causal frames (we are inside an async function)
55 expect(stack['asyncCausalFrames'], isNotNull); 55 expect(stack['asyncCausalFrames'], isNotNull);
56 var asyncStack = stack['asyncCausalFrames']; 56 var asyncStack = stack['asyncCausalFrames'];
57 expect(asyncStack[0].toString(), contains('foobar_async_gen_body')); 57 expect(asyncStack[0].toString(), contains('foobar'));
58 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); 58 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker));
59 expect(asyncStack[2].toString(), contains('foobar')); 59 expect(asyncStack[2].toString(), contains('helper'));
60 expect(asyncStack[3].toString(), contains('helper_async_body')); 60 expect(asyncStack[3].kind, equals(M.FrameKind.asyncSuspensionMarker));
61 expect(asyncStack[4].kind, equals(M.FrameKind.asyncSuspensionMarker)); 61 expect(asyncStack[4].toString(), contains('testMain'));
62 expect(asyncStack[5].toString(), contains('helper'));
63 expect(asyncStack[6].toString(), contains('testMain'));
64 }, 62 },
65 63
66 resumeIsolate, 64 resumeIsolate,
67 hasStoppedAtBreakpoint, 65 hasStoppedAtBreakpoint,
68 stoppedAtLine(LINE_C), 66 stoppedAtLine(LINE_C),
69 67
70 (Isolate isolate) async { 68 (Isolate isolate) async {
71 ServiceMap stack = await isolate.getStack(); 69 ServiceMap stack = await isolate.getStack();
72 // Has causal frames (we are inside a function called by an async function) 70 // Has causal frames (we are inside a function called by an async function)
73 expect(stack['asyncCausalFrames'], isNotNull); 71 expect(stack['asyncCausalFrames'], isNotNull);
74 var asyncStack = stack['asyncCausalFrames']; 72 var asyncStack = stack['asyncCausalFrames'];
75 expect(asyncStack[0].toString(), contains('foobar_async_gen_body')); 73 expect(asyncStack[0].toString(), contains('foobar'));
76 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); 74 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker));
77 expect(asyncStack[2].toString(), contains('foobar')); 75 expect(asyncStack[2].toString(), contains('helper'));
78 expect(asyncStack[3].toString(), contains('helper_async_body')); 76 expect(asyncStack[3].kind, equals(M.FrameKind.asyncSuspensionMarker));
79 expect(asyncStack[4].kind, equals(M.FrameKind.asyncSuspensionMarker)); 77 expect(asyncStack[4].toString(), contains('testMain'));
80 expect(asyncStack[5].toString(), contains('helper'));
81 expect(asyncStack[6].toString(), contains('testMain'));
82 }, 78 },
83 ]; 79 ];
84 80
85 main(args) => runIsolateTestsSynchronous(args, 81 main(args) => runIsolateTestsSynchronous(args,
86 tests, 82 tests,
87 testeeConcurrent: testMain); 83 testeeConcurrent: testMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698