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

Side by Side Diff: tests/standalone/io/http_connection_close_test.dart

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 5
6 import "dart:async"; 6 import "dart:async";
7 import "dart:io"; 7 import "dart:io";
8 import "dart:uri"; 8 import "dart:uri";
9 9
10 void testHttp10Close(bool closeRequest) { 10 void testHttp10Close(bool closeRequest) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void testStreamResponse() { 45 void testStreamResponse() {
46 Timer timer; 46 Timer timer;
47 var server = new HttpServer(); 47 var server = new HttpServer();
48 server.onError = (e) { 48 server.onError = (e) {
49 server.close(); 49 server.close();
50 timer.cancel(); 50 timer.cancel();
51 }; 51 };
52 server.listen("127.0.0.1", 0, backlog: 5); 52 server.listen("127.0.0.1", 0, backlog: 5);
53 server.defaultRequestHandler = (var request, var response) { 53 server.defaultRequestHandler = (var request, var response) {
54 timer = new Timer.repeating(10, (_) { 54 timer = new Timer.repeating(new Duration(milliseconds: 10), (_) {
55 DateTime now = new DateTime.now(); 55 DateTime now = new DateTime.now();
56 try { 56 try {
57 response.outputStream.writeString( 57 response.outputStream.writeString(
58 'data:${now.millisecondsSinceEpoch}\n\n'); 58 'data:${now.millisecondsSinceEpoch}\n\n');
59 } catch (e) { 59 } catch (e) {
60 timer.cancel(); 60 timer.cancel();
61 server.close(); 61 server.close();
62 } 62 }
63 }); 63 });
64 }; 64 };
(...skipping 13 matching lines...) Expand all
78 connection.onError = (e) => Expect.isTrue(e is HttpException); 78 connection.onError = (e) => Expect.isTrue(e is HttpException);
79 } 79 }
80 80
81 main() { 81 main() {
82 testHttp10Close(false); 82 testHttp10Close(false);
83 testHttp10Close(true); 83 testHttp10Close(true);
84 testHttp11Close(false); 84 testHttp11Close(false);
85 testHttp11Close(true); 85 testHttp11Close(true);
86 testStreamResponse(); 86 testStreamResponse();
87 } 87 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_auth_test.dart ('k') | tests/standalone/io/http_server_early_server_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698