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

Unified Diff: sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart

Issue 207563002: Move pub's web socket API over to use JSON RPC 2.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
Index: sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
diff --git a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
index ac77a1cc443901029bcc155e2355e3605445b74c..80aed413b4f1f7f696cafbced543b2d9bbecfb8a 100644
--- a/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
+++ b/sdk/lib/_internal/pub/test/serve/web_socket/path_to_urls_errors_test.dart
@@ -4,6 +4,7 @@
library pub_tests;
+import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
import 'package:path/path.dart' as p;
import '../../descriptor.dart' as d;
@@ -38,29 +39,15 @@ main() {
pubServe(shouldGetFirst: true);
// Bad arguments.
- expectWebSocketCall({
- "command": "pathToUrls"
- }, replyEquals: {
- "code": "BAD_ARGUMENT",
- "error": 'Missing "path" argument.'
- });
+ expectWebSocketCall("pathToUrls", {"path": 123},
+ errorCode: rpc_error_code.INVALID_PARAMS,
+ errorMessage: 'Parameter "path" for method "pathToUrls" must be a '
+ 'string, but was 123.');
- expectWebSocketCall({
- "command": "pathToUrls",
- "path": 123
- }, replyEquals: {
- "code": "BAD_ARGUMENT",
- "error": '"path" must be a string. Got 123.'
- });
-
- expectWebSocketCall({
- "command": "pathToUrls",
- "path": "main.dart",
- "line": 12.34
- }, replyEquals: {
- "code": "BAD_ARGUMENT",
- "error": '"line" must be an integer. Got 12.34.'
- });
+ expectWebSocketCall("pathToUrls", {"path": "main.dart", "line": 12.34},
+ errorCode: rpc_error_code.INVALID_PARAMS,
+ errorMessage: 'Parameter "line" for method "pathToUrls" must be an '
+ 'integer, but was 12.34.');
// Unserved directories.
expectNotServed(p.join('bin', 'foo.txt'));
@@ -73,11 +60,7 @@ main() {
}
void expectNotServed(String path) {
- expectWebSocketCall({
- "command": "pathToUrls",
- "path": path
- }, replyEquals: {
- "code": "NOT_SERVED",
- "error": 'Asset path "$path" is not currently being served.'
- });
+ expectWebSocketCall("pathToUrls", {"path": path},
+ errorCode: 1,
Bob Nystrom 2014/03/21 17:42:25 Make a constant for this (or publicize the one in
nweiz 2014/03/21 20:27:38 Done.
+ errorMessage: 'Asset path "$path" is not currently being served.');
}

Powered by Google App Engine
This is Rietveld 408576698