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

Unified Diff: tests/standalone/io/issue_22637_test.dart

Issue 974953002: Revert "Fix issues with Socket shutdown." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/issue_22637_test.dart
diff --git a/tests/standalone/io/issue_22637_test.dart b/tests/standalone/io/issue_22637_test.dart
deleted file mode 100644
index 689c3a3d67e910545f3a2aae3bef2bfbadd9867b..0000000000000000000000000000000000000000
--- a/tests/standalone/io/issue_22637_test.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-//
-// This test checks that a shutdown(SocketDirection.SEND) of a socket,
-// when the other end is already closed, does not discard unread data
-// that remains in the connection.
-
-import "dart:io";
-import "dart:async";
-import "package:expect/expect.dart";
-
-RawServerSocket server;
-RawSocket client;
-Duration delay = new Duration(seconds: 1);
-
-void serverListen(RawSocket serverSide) {
- var data = new List.generate(200, (i) => i % 20 + 65);
- var offset = 0;
- void serveData(RawSocketEvent event) {
- if (event == RawSocketEvent.WRITE) {
- while (offset < data.length) {
- var written = serverSide.write(data, offset);
- offset += written;
- if (written == 0) {
- serverSide.writeEventsEnabled = true;
- return;
- }
- }
- serverSide.close();
- server.close();
- }
- }
- serverSide.listen(serveData);
-}
-
-
-void clientListen(RawSocketEvent event) {
- if (event == RawSocketEvent.READ) {
- client.readEventsEnabled = false;
- new Future.delayed(delay, () {
- var data = client.read(100);
- if (data == null) {
- // If there is no data ready to read, wait until there is data
- // that can be read, before running the rest of the test.
- client.readEventsEnabled = true;
- return;
- }
- client.shutdown(SocketDirection.SEND);
- data = client.read(100);
- Expect.isNotNull(data);
- client.close();
- });
- }
-}
-
-
-test() async {
- server = await RawServerSocket.bind("localhost", 1968);
- server.listen(serverListen);
- client = await RawSocket.connect("localhost", 1968);
- client.listen(clientListen);
-}
-
-
-void main() {
- test();
-}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698