Chromium Code Reviews| Index: tools/testing/dart/http_server.dart |
| diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart |
| index 08c26f6caf21de28d732d3810a75339efeb45b13..0faa7b0c8d31915d10f3ffc2e55309ae1b37c4a4 100644 |
| --- a/tools/testing/dart/http_server.dart |
| +++ b/tools/testing/dart/http_server.dart |
| @@ -5,6 +5,7 @@ |
| library http_server; |
| import 'dart:async'; |
| +import 'dart:crypto'; |
|
Emily Fortuna
2013/03/18 22:44:22
I don't see where this import is used.
blois
2013/03/18 23:04:48
Remnant from before I noticed the WebSocketTransfo
|
| import 'dart:io'; |
| import 'dart:isolate'; |
| import 'dart:uri'; |
| @@ -132,6 +133,8 @@ class TestingServers { |
| httpServer.listen((HttpRequest request) { |
| if (request.uri.path == "/echo") { |
| _handleEchoRequest(request, request.response); |
| + } else if (request.uri.path == '/ws') { |
| + _handleWebSocketRequest(request); |
| } else { |
| _handleFileOrDirectoryRequest( |
| request, request.response, allowedPort); |
| @@ -186,6 +189,15 @@ class TestingServers { |
| }); |
| } |
| + void _handleWebSocketRequest(HttpRequest request) { |
| + WebSocketTransformer.upgrade(request).then((websocket) { |
| + websocket.listen((data) { |
| + websocket.send(data); |
| + websocket.close(); |
| + }); |
| + }); |
| + } |
| + |
| Path _getFilePathFromRequestPath(String urlRequestPath) { |
| // Go to the top of the file to see an explanation of the URL path scheme. |
| var requestPath = new Path(urlRequestPath.substring(1)).canonicalize(); |