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

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

Issue 12052038: Rename new Uri.fromString to Uri.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload because of Error. Created 7 years, 11 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
« no previous file with comments | « tests/standalone/io/http_client_test.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | 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) 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 };
65 65
66 var client = new HttpClient(); 66 var client = new HttpClient();
67 var connection = 67 var connection =
68 client.getUrl(new Uri.fromString("http://127.0.0.1:${server.port}")); 68 client.getUrl(Uri.parse("http://127.0.0.1:${server.port}"));
69 connection.onResponse = (resp) { 69 connection.onResponse = (resp) {
70 int bytes = 0; 70 int bytes = 0;
71 resp.inputStream.onData = () { 71 resp.inputStream.onData = () {
72 bytes += resp.inputStream.read().length; 72 bytes += resp.inputStream.read().length;
73 if (bytes > 100) { 73 if (bytes > 100) {
74 client.shutdown(force: true); 74 client.shutdown(force: true);
75 } 75 }
76 }; 76 };
77 }; 77 };
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_client_test.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698