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

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

Issue 569173003: Fix datagram issue where available is not correctly updated upon receive. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment Created 6 years, 3 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/raw_datagram_read_all_test.dart
diff --git a/tests/standalone/io/raw_datagram_read_all_test.dart b/tests/standalone/io/raw_datagram_read_all_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..67eef8b3c009aa66f2de8308e0138355c9cb3504
--- /dev/null
+++ b/tests/standalone/io/raw_datagram_read_all_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2014, 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.
+
+import "dart:async";
+import "dart:io";
+import "dart:typed_data";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+
+main() {
+ asyncStart();
+ var address = InternetAddress.LOOPBACK_IP_V4;
+ RawDatagramSocket.bind(address, 0).then((producer) {
+ RawDatagramSocket.bind(address, 0).then((receiver) {
+ int sent = 0;
+ new Timer.periodic(const Duration(microseconds: 1), (timer) {
+ producer.send([0], address, receiver.port);
+ sent++;
+ if (sent == 100) {
+ timer.cancel();
+ producer.close();
+ }
+ });
+ var timer;
+ receiver.listen((event) {
+ if (event != RawSocketEvent.READ) return;
+ var datagram = receiver.receive();
+ Expect.listEquals([0], datagram.data);
+ if (timer != null) timer.cancel();
+ timer = new Timer(const Duration(milliseconds: 200), () {
+ Expect.isNull(receiver.receive());
+ receiver.close();
+ asyncEnd();
+ });
+ });
+ });
+ });
+}
+
« 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