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

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

Issue 16363005: Ensure that only byte values are sent by sockets and web sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed a few bugs Created 7 years, 6 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/websocket_impl.dart ('k') | tests/standalone/io/raw_socket_typed_data_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) 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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | tests/standalone/io/raw_socket_typed_data_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698