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

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

Issue 1093043004: Do not JSON encode the 'result' of a service rpc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 8 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
« no previous file with comments | « runtime/observatory/tests/service/isolate_lifecycle_test.dart ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/malformed_test.dart
diff --git a/runtime/observatory/tests/service/malformed_test.dart b/runtime/observatory/tests/service/malformed_test.dart
index 1d61a46a73ad06cf914aa2da72d551a4b99fb06f..b5f86dd5c4c753a18f978009a3a7800a56829169 100644
--- a/runtime/observatory/tests/service/malformed_test.dart
+++ b/runtime/observatory/tests/service/malformed_test.dart
@@ -8,22 +8,25 @@ import 'package:unittest/unittest.dart';
import 'test_helper.dart';
var tests = [
+ (Isolate isolate) async {
+ await isolate.invokeRpc('_respondWithMalformedObject', {}).then((result) {
+ expect(false, isTrue, reason:'Unreachable');
+ }).catchError((ServiceException exception) {
+ expect(exception.kind, equals('ResponseFormatException'));
+ expect(exception.message,
+ startsWith("Response is missing the 'type' field"));
+ });
+ },
-(Isolate isolate) =>
- isolate.invokeRpc('_respondWithMalformedJson', { }).then((result) {
- // Should not execute.
- expect(true, false);
- }).catchError((ServiceException exception) {
- expect(exception.kind, equals('JSONDecodeException'));
- }),
-
-(Isolate isolate) =>
- isolate.invokeRpc('_respondWithMalformedObject', { }).then((result) {
- // Should not execute.
- expect(true, false);
- }).catchError((ServiceException exception) {
- expect(exception.kind, equals('ResponseFormatException'));
- }),
+ // Do this test last... it kills the vm connection.
+ (Isolate isolate) async {
+ await isolate.invokeRpc('_respondWithMalformedJson', {}).then((result) {
+ expect(false, isTrue, reason:'Unreachable');
+ }).catchError((ServiceException exception) {
+ expect(exception.kind, equals('ConnectionClosed'));
+ expect(exception.message, startsWith('Error decoding JSON message'));
+ });
+ },
];
main(args) => runIsolateTests(args, tests);
« no previous file with comments | « runtime/observatory/tests/service/isolate_lifecycle_test.dart ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698