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

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

Issue 3006743003: Restore "Avoid to run dart code during paused_on_exit" (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « runtime/observatory/.analysis_options ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--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 'service_test_common.dart';
11 import 'test_helper.dart';
12
13 import "dart:isolate" as dart;
14
15 void isolate(dart.SendPort port) {
16 dart.RawReceivePort receive = new dart.RawReceivePort((_) {
17 debugger();
18 throw new Exception();
19 });
20 port.send(receive.sendPort);
21 }
22
23 void test() {
24 dart.RawReceivePort receive = new dart.RawReceivePort((port) {
25 debugger();
26 port.send(null);
27 debugger();
28 port.send(null);
29 debugger();
30 });
31 dart.Isolate.spawn(isolate, receive.sendPort);
32 }
33
34 var tests = [
35 (VM vm) async {
36 await vm.load();
37 bool started = false;
38 int step = 0;
39 var completer = new Completer();
40 var sub;
41 await hasPausedAtStart(vm.isolates[0]);
42 sub = await vm.listenEventStream("Debug", (ServiceEvent c) {
43 switch (step) {
44 case 0:
45 expect(c.kind, equals("Resume"),
46 reason: "First isolate should resume");
47 expect(c.isolate.id, equals(vm.isolates[0].id),
48 reason: "First isolate should resume");
49 break;
50 case 1:
51 expect(c.kind, equals("PauseStart"),
52 reason: "Second isolate should pause on start");
53 expect(c.isolate.id, equals(vm.isolates[1].id),
54 reason: "Second isolate should pause on start");
55 vm.isolates[1].resume();
56 break;
57 case 2:
58 expect(c.kind, equals("Resume"),
59 reason: "Second isolate should resume");
60 expect(c.isolate.id, equals(vm.isolates[1].id),
61 reason: "Second isolate should resume");
62 break;
63 case 3:
64 expect(c.kind, equals("PauseBreakpoint"),
65 reason: "First isolate should stop at debugger()");
66 expect(c.isolate.id, equals(vm.isolates[0].id),
67 reason: "First isolate should stop at debugger()");
68 vm.isolates[0].resume();
69 break;
70 case 4:
71 expect(c.kind, equals("Resume"),
72 reason: "First isolate should resume (1)");
73 expect(c.isolate.id, equals(vm.isolates[0].id),
74 reason: "First isolate should resume (1)");
75 break;
76 case 5:
77 expect(c.kind, equals("PauseBreakpoint"),
78 reason: "First & Second isolate should stop at debugger()");
79 break;
80 case 6:
81 expect(c.kind, equals("PauseBreakpoint"),
82 reason: "First & Second isolate should stop at debugger()");
83 vm.isolates[1].resume();
84 break;
85 case 7:
86 expect(c.kind, equals("Resume"),
87 reason: "Second isolate should resume before the exception");
88 expect(c.isolate.id, equals(vm.isolates[1].id),
89 reason: "Second isolate should resume before the exception");
90 break;
91 case 8:
92 expect(c.kind, equals("PauseExit"),
93 reason: "Second isolate should exit at the exception");
94 expect(c.isolate.id, equals(vm.isolates[1].id),
95 reason: "Second isolate should exit at the exception");
96 vm.isolates[0].resume();
97 break;
98 case 9:
99 expect(c.kind, equals("Resume"),
100 reason: "First isolate should resume after the exception");
101 expect(c.isolate.id, equals(vm.isolates[0].id),
102 reason: "First isolate should resume after the exception");
103 break;
104 case 10:
105 expect(c.kind, equals("PauseBreakpoint"),
106 reason: "First isolate "
107 "should stop at debugger() after exception.\n"
108 "Probably the second resumed even though it was not expect "
109 "to do it.");
110 expect(c.isolate.id, equals(vm.isolates[0].id),
111 reason: "First "
112 "isolate should stop at debugger() after exception.\n"
113 "Probably the second resumed even though it was not expect "
114 "to do it.");
115 completer.complete();
116 break;
117 default:
118 expect(false, isTrue,
119 reason: "Shouldn't get here, the second "
120 "isolate resumed even though it was not expect to do it");
121 break;
122 }
123 step++;
124 });
125 vm.isolates[0].resume();
126 await completer.future;
127 // We wait 1 second to account for delays in the service protocol.
128 // A late message can still arrive.
129 await new Future.delayed(const Duration(seconds: 1));
130 // No fails, tear down the stream.
131 sub.cancel();
132 }
133 ];
134
135 main(args) async => runVMTests(args, tests,
136 pause_on_start: true, pause_on_exit: true, testeeConcurrent: test);
OLDNEW
« no previous file with comments | « runtime/observatory/.analysis_options ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698