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

Side by Side Diff: tools/testing/dart/http_server.dart

Issue 1513363003: fix safari test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « tests/html/websocket_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library http_server; 5 library http_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'dart:convert' show 10 import 'dart:convert' show
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 }); 253 });
254 } 254 }
255 255
256 void _handleWebSocketRequest(HttpRequest request) { 256 void _handleWebSocketRequest(HttpRequest request) {
257 WebSocketTransformer.upgrade(request).then((websocket) { 257 WebSocketTransformer.upgrade(request).then((websocket) {
258 // We ignore failures to write to the socket, this happens if the browser 258 // We ignore failures to write to the socket, this happens if the browser
259 // closes the connection. 259 // closes the connection.
260 websocket.done.catchError((_) {}); 260 websocket.done.catchError((_) {});
261 websocket.listen((data) { 261 websocket.listen((data) {
262 websocket.add(data); 262 websocket.add(data);
263 websocket.close(); 263 if (data == 'close-with-error') {
264 // Note: according to the web-sockets spec, a reason longer than 123
265 // bytes will produce a SyntaxError on the client.
266 websocket.close(WebSocketStatus.UNSUPPORTED_DATA, 'X' * 124);
267 } else {
268 websocket.close();
269 }
264 }, onError: (e) { 270 }, onError: (e) {
265 DebugLogger.warning('HttpServer: error while echoing to WebSocket', e); 271 DebugLogger.warning('HttpServer: error while echoing to WebSocket', e);
266 }); 272 });
267 }).catchError((e) { 273 }).catchError((e) {
268 DebugLogger.warning( 274 DebugLogger.warning(
269 'HttpServer: error while transforming to WebSocket', e); 275 'HttpServer: error while transforming to WebSocket', e);
270 }); 276 });
271 } 277 }
272 278
273 Path _getFilePathFromRequestPath(String urlRequestPath) { 279 Path _getFilePathFromRequestPath(String urlRequestPath) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 class _Entry implements Comparable { 462 class _Entry implements Comparable {
457 final String name; 463 final String name;
458 final String displayName; 464 final String displayName;
459 465
460 _Entry(this.name, this.displayName); 466 _Entry(this.name, this.displayName);
461 467
462 int compareTo(_Entry other) { 468 int compareTo(_Entry other) {
463 return name.compareTo(other.name); 469 return name.compareTo(other.name);
464 } 470 }
465 } 471 }
OLDNEW
« no previous file with comments | « tests/html/websocket_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698