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

Unified Diff: pkg/json_rpc_2/test/server/utils.dart

Issue 205533005: Create a package that implements a JSON-RPC 2.0 server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 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
« no previous file with comments | « pkg/json_rpc_2/test/server/server_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/json_rpc_2/test/server/utils.dart
diff --git a/pkg/json_rpc_2/test/server/utils.dart b/pkg/json_rpc_2/test/server/utils.dart
new file mode 100644
index 0000000000000000000000000000000000000000..07f571ce6c295dda02cb63ce608b78d96d08df37
--- /dev/null
+++ b/pkg/json_rpc_2/test/server/utils.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library json_rpc_2.test.server.util;
+
+import 'package:unittest/unittest.dart';
+import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
+
+void expectErrorResponse(json_rpc.Server server, request, int errorCode,
+ String message) {
+ var id;
+ if (request is Map) id = request['id'];
+
+ expect(server.handleRequest(request), completion(equals({
+ 'jsonrpc': '2.0',
+ 'id': id,
+ 'error': {
+ 'code': errorCode,
+ 'message': message,
+ 'data': {'request': request}
+ }
+ })));
+}
+
+Matcher throwsInvalidParams(String message) {
+ return throwsA(predicate((error) {
+ expect(error, new isInstanceOf<json_rpc.RpcException>());
+ expect(error.message, equals(message));
+ return true;
+ }));
+}
« no previous file with comments | « pkg/json_rpc_2/test/server/server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698