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

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

Issue 1311503004: Remember when an isolate was paused and subtly display it in Obseravatory (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart';
7 import 'test_helper.dart'; 8 import 'test_helper.dart';
8 import 'dart:async'; 9 import 'dart:async';
9 10
10 void testMain() { 11 void testMain() {
11 print('Hello'); 12 print('Hello');
12 } 13 }
13 14
14 var tests = [ 15 var tests = [
15 16
16 (Isolate isolate) async { 17 (Isolate isolate) async {
(...skipping 11 matching lines...) Expand all
28 if (isolate.pauseEvent != null && 29 if (isolate.pauseEvent != null &&
29 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) { 30 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) {
30 // Wait for the isolate to hit PauseStart. 31 // Wait for the isolate to hit PauseStart.
31 subscription.cancel(); 32 subscription.cancel();
32 print('subscription cancelled.'); 33 print('subscription cancelled.');
33 } else { 34 } else {
34 print('waiting for pause start event.'); 35 print('waiting for pause start event.');
35 await completer.future; 36 await completer.future;
36 } 37 }
37 38
39 // Grab the timestamp.
40 var pausetime1 = isolate.pauseEvent.timestamp;
41 expect(pausetime1, isNotNull);
42 // Reload the isolate.
43 await isolate.reload();
44 // Verify that it is the same.
45 expect(pausetime1.millisecondsSinceEpoch,
46 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
47
38 completer = new Completer(); 48 completer = new Completer();
39 stream = await isolate.vm.getEventStream(VM.kDebugStream); 49 stream = await isolate.vm.getEventStream(VM.kDebugStream);
40 subscription = stream.listen((ServiceEvent event) { 50 subscription = stream.listen((ServiceEvent event) {
41 if (event.kind == ServiceEvent.kPauseBreakpoint) { 51 if (event.kind == ServiceEvent.kPauseBreakpoint) {
42 print('Received PauseBreakpoint'); 52 print('Received PauseBreakpoint');
43 subscription.cancel(); 53 subscription.cancel();
44 completer.complete(); 54 completer.complete();
45 } 55 }
46 print('Got ${event.kind}'); 56 print('Got ${event.kind}');
47 }); 57 });
48 58
49 print('Stepping...'); 59 print('Stepping...');
50 isolate.stepInto(); 60 isolate.stepInto();
51 61
52 // Wait for the isolate to hit PauseBreakpoint. 62 // Wait for the isolate to hit PauseBreakpoint.
53 print('Waiting for PauseBreakpoint'); 63 print('Waiting for PauseBreakpoint');
54 await completer.future; 64 await completer.future;
65
66 // Grab the timestamp.
67 var pausetime2 = isolate.pauseEvent.timestamp;
68 expect(pausetime2, isNotNull);
69 // Reload the isolate.
70 await isolate.reload();
71 // Verify that it is the same.
72 expect(pausetime2.millisecondsSinceEpoch,
73 equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch));
74
75 expect(pausetime2.millisecondsSinceEpoch,
76 greaterThan(pausetime1.millisecondsSinceEpoch));
55 }, 77 },
56 78
57 ]; 79 ];
58 80
59 main(args) => runIsolateTests(args, tests, 81 main(args) => runIsolateTests(args, tests,
60 testeeConcurrent: testMain, 82 testeeConcurrent: testMain,
61 pause_on_start: true, pause_on_exit: true); 83 pause_on_start: true, pause_on_exit: true);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698