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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. Created 3 years, 9 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 'package:observatory/models.dart' as M; 6 import 'package:observatory/models.dart' as M;
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 'test_helper.dart'; 9 import 'test_helper.dart';
10 import 'dart:async'; 10 import 'dart:async';
11 11
12 void testMain() { 12 void testMain() {
13 print('Hello'); 13 print('Hello');
14 } 14 }
15 15
16 var tests = [ 16 var tests = [
17 (Isolate isolate) async {
18 print('Getting stream...');
19 Completer completer = new Completer();
20 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
21 print('Subscribing...');
22 var subscription;
23 subscription = stream.listen((ServiceEvent event) {
24 if (event.kind == ServiceEvent.kPauseStart) {
25 print('Received $event');
26 subscription.cancel();
27 completer.complete();
28 } else {
29 print('Ignoring event $event');
30 }
31 });
32 print('Subscribed. Pause event is ${isolate.pauseEvent}');
17 33
18 (Isolate isolate) async { 34 if (isolate.pauseEvent != null && isolate.pauseEvent is M.PauseStartEvent) {
19 print('Getting stream...'); 35 // Wait for the isolate to hit PauseStart.
20 Completer completer = new Completer();
21 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
22 print('Subscribing...');
23 var subscription;
24 subscription = stream.listen((ServiceEvent event) {
25 if (event.kind == ServiceEvent.kPauseStart) {
26 print('Received $event');
27 subscription.cancel(); 36 subscription.cancel();
28 completer.complete(); 37 print('Subscription cancelled.');
29 } else { 38 } else {
30 print('Ignoring event $event'); 39 print('Waiting for pause start event.');
40 await completer.future;
31 } 41 }
32 }); 42 print('Done waiting for pause event.');
33 print('Subscribed. Pause event is ${isolate.pauseEvent}');
34 43
35 if (isolate.pauseEvent != null && 44 // Grab the timestamp.
36 isolate.pauseEvent is M.PauseStartEvent) { 45 var pausetime1 = isolate.pauseEvent.timestamp;
37 // Wait for the isolate to hit PauseStart. 46 expect(pausetime1, isNotNull);
38 subscription.cancel(); 47 // Reload the isolate.
39 print('Subscription cancelled.'); 48 await isolate.reload();
40 } else { 49 // Verify that it is the same.
41 print('Waiting for pause start event.'); 50 expect(pausetime1.millisecondsSinceEpoch,
51 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
52
53 completer = new Completer();
54 stream = await isolate.vm.getEventStream(VM.kDebugStream);
55 subscription = stream.listen((ServiceEvent event) {
56 if (event.kind == ServiceEvent.kPauseBreakpoint) {
57 print('Received PauseBreakpoint');
58 subscription.cancel();
59 completer.complete();
60 }
61 print('Got ${event.kind}');
62 });
63
64 print('Stepping...');
65 isolate.stepInto();
66
67 // Wait for the isolate to hit PauseBreakpoint.
68 print('Waiting for PauseBreakpoint');
42 await completer.future; 69 await completer.future;
43 }
44 print('Done waiting for pause event.');
45 70
46 // Grab the timestamp. 71 // Grab the timestamp.
47 var pausetime1 = isolate.pauseEvent.timestamp; 72 var pausetime2 = isolate.pauseEvent.timestamp;
48 expect(pausetime1, isNotNull); 73 expect(pausetime2, isNotNull);
49 // Reload the isolate. 74 // Reload the isolate.
50 await isolate.reload(); 75 await isolate.reload();
51 // Verify that it is the same. 76 // Verify that it is the same.
52 expect(pausetime1.millisecondsSinceEpoch, 77 expect(pausetime2.millisecondsSinceEpoch,
53 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); 78 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
54 79
55 completer = new Completer(); 80 expect(pausetime2.millisecondsSinceEpoch,
56 stream = await isolate.vm.getEventStream(VM.kDebugStream);
57 subscription = stream.listen((ServiceEvent event) {
58 if (event.kind == ServiceEvent.kPauseBreakpoint) {
59 print('Received PauseBreakpoint');
60 subscription.cancel();
61 completer.complete();
62 }
63 print('Got ${event.kind}');
64 });
65
66 print('Stepping...');
67 isolate.stepInto();
68
69 // Wait for the isolate to hit PauseBreakpoint.
70 print('Waiting for PauseBreakpoint');
71 await completer.future;
72
73 // Grab the timestamp.
74 var pausetime2 = isolate.pauseEvent.timestamp;
75 expect(pausetime2, isNotNull);
76 // Reload the isolate.
77 await isolate.reload();
78 // Verify that it is the same.
79 expect(pausetime2.millisecondsSinceEpoch,
80 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
81
82 expect(pausetime2.millisecondsSinceEpoch,
83 greaterThan(pausetime1.millisecondsSinceEpoch)); 81 greaterThan(pausetime1.millisecondsSinceEpoch));
84 }, 82 },
85
86 ]; 83 ];
87 84
88 main(args) => runIsolateTests(args, tests, 85 main(args) => runIsolateTests(args, tests,
89 testeeConcurrent: testMain, 86 testeeConcurrent: testMain,
90 pause_on_start: true, 87 pause_on_start: true,
91 pause_on_exit: true, 88 pause_on_exit: true,
92 verbose_vm: true, 89 verbose_vm: true,
93 extraArgs: [ '--trace-service', 90 extraArgs: ['--trace-service', '--trace-service-verbose']);
94 '--trace-service-verbose' ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698