| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 // VMOptions= | 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 void testSimpleReadWrite() { | 131 void testSimpleReadWrite() { |
| 132 // This test creates a server and a client connects. The client then | 132 // This test creates a server and a client connects. The client then |
| 133 // writes and the server echos. When the server has finished its | 133 // writes and the server echos. When the server has finished its |
| 134 // echo it half-closes. When the client gets the close event is | 134 // echo it half-closes. When the client gets the close event is |
| 135 // closes fully. | 135 // closes fully. |
| 136 ReceivePort port = new ReceivePort(); | 136 ReceivePort port = new ReceivePort(); |
| 137 | 137 |
| 138 const messageSize = 1000; | 138 const messageSize = 1000; |
| 139 | 139 |
| 140 List<int> createTestData() { | 140 List<int> createTestData() { |
| 141 List<int> data = new List<int>(messageSize); | 141 return new List<int>.generate(messageSize, (index) => index & 0xff); |
| 142 for (int i = 0; i < messageSize; i++) { | |
| 143 data[i] = i & 0xff; | |
| 144 } | |
| 145 return data; | |
| 146 } | 142 } |
| 147 | 143 |
| 148 void verifyTestData(List<int> data) { | 144 void verifyTestData(List<int> data) { |
| 149 Expect.equals(messageSize, data.length); | 145 Expect.equals(messageSize, data.length); |
| 150 List<int> expected = createTestData(); | 146 List<int> expected = createTestData(); |
| 151 for (int i = 0; i < messageSize; i++) { | 147 for (int i = 0; i < messageSize; i++) { |
| 152 Expect.equals(expected[i], data[i]); | 148 Expect.equals(expected[i], data[i]); |
| 153 } | 149 } |
| 154 } | 150 } |
| 155 | 151 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 testSimpleBind(); | 345 testSimpleBind(); |
| 350 testCloseOneEnd("client"); | 346 testCloseOneEnd("client"); |
| 351 testCloseOneEnd("server"); | 347 testCloseOneEnd("server"); |
| 352 testInvalidBind(); | 348 testInvalidBind(); |
| 353 testSimpleConnect(); | 349 testSimpleConnect(); |
| 354 testServerListenAfterConnect(); | 350 testServerListenAfterConnect(); |
| 355 testSimpleReadWrite(); | 351 testSimpleReadWrite(); |
| 356 testPauseServerSocket(); | 352 testPauseServerSocket(); |
| 357 testPauseSocket(); | 353 testPauseSocket(); |
| 358 } | 354 } |
| OLD | NEW |