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

Unified Diff: runtime/observatory/tests/service/debugging_test.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/debugging_test.dart
diff --git a/runtime/observatory/tests/service/debugging_test.dart b/runtime/observatory/tests/service/debugging_test.dart
index 837a924a55c9e0ff236db7994e8857218a1117da..c43dcbb7eee3c50d952236bcee580b8817af1319 100644
--- a/runtime/observatory/tests/service/debugging_test.dart
+++ b/runtime/observatory/tests/service/debugging_test.dart
@@ -12,7 +12,7 @@ int counter = 0;
void periodicTask(_) {
counter++;
- counter++; // Line 15. We set our breakpoint here.
+ counter++; // Line 15. We set our breakpoint here.
counter++;
if (counter % 300 == 0) {
print('counter = $counter');
@@ -20,191 +20,190 @@ void periodicTask(_) {
}
void startTimer() {
- new Timer.periodic(const Duration(milliseconds: 10), periodicTask);
+ new Timer.periodic(const Duration(milliseconds:10), periodicTask);
}
var tests = [
+
// Pause
- (Isolate isolate) async {
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseInterrupted) {
- subscription.cancel();
- completer.complete();
- }
- });
- isolate.pause();
- await completer.future;
- },
+(Isolate isolate) async {
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kPauseInterrupted) {
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+ isolate.pause();
+ await completer.future;
+},
// Resume
- (Isolate isolate) async {
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kResume) {
- subscription.cancel();
- completer.complete();
- }
- });
- isolate.resume();
- await completer.future;
- },
+(Isolate isolate) async {
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kResume) {
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+ isolate.resume();
+ await completer.future;
+},
// Add breakpoint
- (Isolate isolate) async {
- await isolate.rootLibrary.load();
-
- // Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseBreakpoint) {
- print('Breakpoint reached');
- subscription.cancel();
- completer.complete();
- }
- });
-
- var script = isolate.rootLibrary.scripts[0];
- await script.load();
-
- // Add the breakpoint.
- var result = await isolate.addBreakpoint(script, 15);
- expect(result is Breakpoint, isTrue);
- Breakpoint bpt = result;
- expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.id, equals(script.id));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(15));
- expect(isolate.breakpoints.length, equals(1));
-
- await completer.future; // Wait for breakpoint events.
- },
+(Isolate isolate) async {
+ await isolate.rootLibrary.load();
+
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ print('Breakpoint reached');
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+
+ var script = isolate.rootLibrary.scripts[0];
+ await script.load();
+
+ // Add the breakpoint.
+ var result = await isolate.addBreakpoint(script, 15);
+ expect(result is Breakpoint, isTrue);
+ Breakpoint bpt = result;
+ expect(bpt.type, equals('Breakpoint'));
+ expect(bpt.location.script.id, equals(script.id));
+ expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(15));
+ expect(isolate.breakpoints.length, equals(1));
+
+ await completer.future; // Wait for breakpoint events.
+},
// We are at the breakpoint on line 15.
- (Isolate isolate) async {
- ServiceMap stack = await isolate.getStack();
- expect(stack.type, equals('Stack'));
- expect(stack['frames'].length, greaterThanOrEqualTo(1));
+(Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(1));
- Script script = stack['frames'][0].location.script;
- expect(script.name, endsWith('debugging_test.dart'));
- expect(
- script.tokenToLine(stack['frames'][0].location.tokenPos), equals(15));
- },
+ Script script = stack['frames'][0].location.script;
+ expect(script.name,endsWith('debugging_test.dart'));
+ expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(15));
+},
// Stepping
- (Isolate isolate) async {
- // Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseBreakpoint) {
- print('Breakpoint reached');
- subscription.cancel();
- completer.complete();
- }
- });
-
- await isolate.stepOver();
- await completer.future; // Wait for breakpoint events.
- },
+(Isolate isolate) async {
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ print('Breakpoint reached');
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+
+ await isolate.stepOver();
+ await completer.future; // Wait for breakpoint events.
+},
// We are now at line 16.
- (Isolate isolate) async {
- ServiceMap stack = await isolate.getStack();
- expect(stack.type, equals('Stack'));
- expect(stack['frames'].length, greaterThanOrEqualTo(1));
+(Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(1));
- Script script = stack['frames'][0].location.script;
- expect(script.name, endsWith('debugging_test.dart'));
- expect(
- script.tokenToLine(stack['frames'][0].location.tokenPos), equals(16));
- },
+ Script script = stack['frames'][0].location.script;
+ expect(script.name,endsWith('debugging_test.dart'));
+ expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(16));
+},
// Remove breakpoint
- (Isolate isolate) async {
- // Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kBreakpointRemoved) {
- print('Breakpoint removed');
- expect(isolate.breakpoints.length, equals(0));
- subscription.cancel();
- completer.complete();
- }
- });
-
- expect(isolate.breakpoints.length, equals(1));
- var bpt = isolate.breakpoints.values.first;
- await isolate.removeBreakpoint(bpt);
- await completer.future;
- },
+(Isolate isolate) async {
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kBreakpointRemoved) {
+ print('Breakpoint removed');
+ expect(isolate.breakpoints.length, equals(0));
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+
+ expect(isolate.breakpoints.length, equals(1));
+ var bpt = isolate.breakpoints.values.first;
+ await isolate.removeBreakpoint(bpt);
+ await completer.future;
+},
// Resume
- (Isolate isolate) async {
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kResume) {
- subscription.cancel();
- completer.complete();
- }
- });
- isolate.resume();
- await completer.future;
- },
+(Isolate isolate) async {
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kResume) {
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+ isolate.resume();
+ await completer.future;
+},
// Add breakpoint at function entry
- (Isolate isolate) async {
- // Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseBreakpoint) {
- print('Breakpoint reached');
- subscription.cancel();
- completer.complete();
- }
- });
-
- // Find a specific function.
- ServiceFunction function = isolate.rootLibrary.functions
- .firstWhere((f) => f.name == 'periodicTask');
- expect(function, isNotNull);
-
- // Add the breakpoint at function entry
- var result = await isolate.addBreakpointAtEntry(function);
- expect(result is Breakpoint, isTrue);
- Breakpoint bpt = result;
- expect(bpt.type, equals('Breakpoint'));
- expect(bpt.location.script.name, equals('debugging_test.dart'));
- expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(13));
- expect(isolate.breakpoints.length, equals(1));
-
- await completer.future; // Wait for breakpoint events.
- },
+(Isolate isolate) async {
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ print('Breakpoint reached');
+ subscription.cancel();
+ completer.complete();
+ }
+ });
+
+ // Find a specific function.
+ ServiceFunction function = isolate.rootLibrary.functions.firstWhere(
+ (f) => f.name == 'periodicTask');
+ expect(function, isNotNull);
+
+ // Add the breakpoint at function entry
+ var result = await isolate.addBreakpointAtEntry(function);
+ expect(result is Breakpoint, isTrue);
+ Breakpoint bpt = result;
+ expect(bpt.type, equals('Breakpoint'));
+ expect(bpt.location.script.name, equals('debugging_test.dart'));
+ expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), equals(13));
+ expect(isolate.breakpoints.length, equals(1));
+
+ await completer.future; // Wait for breakpoint events.
+},
// We are now at line 13.
- (Isolate isolate) async {
- ServiceMap stack = await isolate.getStack();
- expect(stack.type, equals('Stack'));
- expect(stack['frames'].length, greaterThanOrEqualTo(1));
-
- Script script = stack['frames'][0].location.script;
- expect(script.name, endsWith('debugging_test.dart'));
- expect(
- script.tokenToLine(stack['frames'][0].location.tokenPos), equals(13));
- },
+(Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(1));
+
+ Script script = stack['frames'][0].location.script;
+ expect(script.name,endsWith('debugging_test.dart'));
+ expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(13));
+},
+
];
main(args) => runIsolateTests(args, tests, testeeBefore: startTimer);

Powered by Google App Engine
This is Rietveld 408576698