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

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

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (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/pause_on_exceptions_test.dart
diff --git a/runtime/observatory/tests/service/pause_on_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
index da2e2503a217076885a2d83b6a7f6f9c9a276f1e..61668d7f8ec40d61d468567e54af7a62ea204258 100644
--- a/runtime/observatory/tests/service/pause_on_exceptions_test.dart
+++ b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
@@ -25,86 +25,82 @@ doUncaught() {
}
var tests = [
-
-(Isolate isolate) async {
- var lib = await isolate.rootLibrary.reload();
-
- var onPaused = null;
- var onResume = null;
-
- var stream = await isolate.vm.getEventStream(VM.kDebugStream);
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- print("Event $event");
- if (event.kind == ServiceEvent.kPauseException) {
- if (onPaused == null) throw "Unexpected pause event $event";
- var t = onPaused;
- onPaused = null;
- t.complete(event);
- }
- if (event.kind == ServiceEvent.kResume) {
- if (onResume == null) throw "Unexpected resume event $event";
- var t = onResume;
- onResume = null;
- t.complete(event);
- }
- });
-
- test(String pauseMode,
- String expression,
- bool shouldPause,
- bool shouldBeCaught) async {
- print("Evaluating $expression with pause on $pauseMode exception");
-
- expect((await isolate.setExceptionPauseMode(pauseMode)) is DartError,
- isFalse);
-
- var t;
- if (shouldPause) {
- t = new Completer();
- onPaused = t;
- }
- var fres = lib.evaluate(expression);
- if (shouldPause) {
- await t.future;
-
- var stack = await isolate.getStack();
- expect(stack['frames'][0].function.name, equals('doThrow'));
- // Ugh, no .line. expect(stack['frames'][0].location.line, equals(17));
-
- t = new Completer();
- onResume = t;
- isolate.resume();
- await t.future;
+ (Isolate isolate) async {
+ var lib = await isolate.rootLibrary.reload();
+
+ var onPaused = null;
+ var onResume = null;
+
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream);
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ print("Event $event");
+ if (event.kind == ServiceEvent.kPauseException) {
+ if (onPaused == null) throw "Unexpected pause event $event";
+ var t = onPaused;
+ onPaused = null;
+ t.complete(event);
+ }
+ if (event.kind == ServiceEvent.kResume) {
+ if (onResume == null) throw "Unexpected resume event $event";
+ var t = onResume;
+ onResume = null;
+ t.complete(event);
+ }
+ });
+
+ test(String pauseMode, String expression, bool shouldPause,
+ bool shouldBeCaught) async {
+ print("Evaluating $expression with pause on $pauseMode exception");
+
+ expect((await isolate.setExceptionPauseMode(pauseMode)) is DartError,
+ isFalse);
+
+ var t;
+ if (shouldPause) {
+ t = new Completer();
+ onPaused = t;
+ }
+ var fres = lib.evaluate(expression);
+ if (shouldPause) {
+ await t.future;
+
+ var stack = await isolate.getStack();
+ expect(stack['frames'][0].function.name, equals('doThrow'));
+ // Ugh, no .line. expect(stack['frames'][0].location.line, equals(17));
+
+ t = new Completer();
+ onResume = t;
+ isolate.resume();
+ await t.future;
+ }
+
+ var res = await fres;
+ print(res);
+ if (shouldBeCaught) {
+ expect(res.isInstance, isTrue);
+ expect(res.isString, isTrue);
+ expect(res.valueAsString, equals("end of doCaught"));
+ } else {
+ expect(res.isError, isTrue);
+ await res.load(); // Weird?
+ expect(res.exception.isInstance, isTrue);
+ expect(res.exception.isString, isTrue);
+ expect(res.exception.valueAsString, equals("TheException"));
+ }
}
- var res = await fres;
- print(res);
- if (shouldBeCaught) {
- expect(res.isInstance, isTrue);
- expect(res.isString, isTrue);
- expect(res.valueAsString, equals("end of doCaught"));
- } else {
- expect(res.isError, isTrue);
- await res.load(); // Weird?
- expect(res.exception.isInstance, isTrue);
- expect(res.exception.isString, isTrue);
- expect(res.exception.valueAsString, equals("TheException"));
- }
- }
-
- await test("All", "doCaught()", true, true);
- await test("All", "doUncaught()", true, false);
-
- await test("Unhandled", "doCaught()", false, true);
- await test("Unhandled", "doUncaught()", true, false);
+ await test("All", "doCaught()", true, true);
+ await test("All", "doUncaught()", true, false);
- await test("None", "doCaught()", false, true);
- await test("None", "doUncaught()", false, false);
+ await test("Unhandled", "doCaught()", false, true);
+ await test("Unhandled", "doUncaught()", true, false);
- subscription.cancel();
-},
+ await test("None", "doCaught()", false, true);
+ await test("None", "doUncaught()", false, false);
+ subscription.cancel();
+ },
];
main(args) => runIsolateTests(args, tests);

Powered by Google App Engine
This is Rietveld 408576698