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

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

Issue 11783060: Revert "Add onClosed callbacks to HTTP output streams" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « sdk/lib/io/http_impl.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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5
6 import "dart:io";
7 import "dart:uri";
8
9 main() {
10 bool serverOnClosed = false;
11 bool clientOnClosed = false;
12
13 var server = new HttpServer();
14 server.listen("127.0.0.1", 0);
15 server.defaultRequestHandler = (request, response) {
16 request.inputStream.onData = request.inputStream.read;
17 request.inputStream.onClosed = () {
18 response.outputStream.onClosed = () => serverOnClosed = true;
19 response.outputStream.writeString("hello!");
20 response.outputStream.close();
21 };
22 };
23
24 var client = new HttpClient();
25 var connection = client.postUrl(new Uri.fromString("http://127.0.0.1:${serve r.port}"));
26 connection.onError = (e) => throw e;
27 connection.onRequest = (request) {
28 request.contentLength = "hello!".length;
29 request.outputStream.onError = (e) => throw e;
30 request.outputStream.onClosed = () => clientOnClosed = true;
31 request.outputStream.writeString("hello!");
32 request.outputStream.close();
33 };
34 connection.onResponse = (response) {
35 response.inputStream.onData = response.inputStream.read;
36 response.inputStream.onClosed = () {
37 Expect.isTrue(serverOnClosed && clientOnClosed);
38 server.close();
39 client.shutdown();
40 };
41 };
42 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698