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

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

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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
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 "dart:async"; 10 import "dart:async";
(...skipping 26 matching lines...) Expand all
37 bytesWritten += client.write( 37 bytesWritten += client.write(
38 dataToWrite, bytesWritten, dataToWrite.length - bytesWritten); 38 dataToWrite, bytesWritten, dataToWrite.length - bytesWritten);
39 if (bytesWritten < dataToWrite.length) { 39 if (bytesWritten < dataToWrite.length) {
40 client.writeEventsEnabled = true; 40 client.writeEventsEnabled = true;
41 } 41 }
42 if (bytesWritten == dataToWrite.length) { 42 if (bytesWritten == dataToWrite.length) {
43 client.shutdown(SocketDirection.SEND); 43 client.shutdown(SocketDirection.SEND);
44 } 44 }
45 break; 45 break;
46 case RawSocketEvent.READ_CLOSED: 46 case RawSocketEvent.READ_CLOSED:
47 dataToWrite = readChunks.reduce(<int>[], (list, x) { 47 dataToWrite = readChunks.fold(<int>[], (list, x) {
48 list.addAll(x); 48 list.addAll(x);
49 return list; 49 return list;
50 }); 50 });
51 client.writeEventsEnabled = true; 51 client.writeEventsEnabled = true;
52 break; 52 break;
53 } 53 }
54 }); 54 });
55 }); 55 });
56 return server; 56 return server;
57 }); 57 });
(...skipping 24 matching lines...) Expand all
82 Path certificateDatabase = scriptDir.append('pkcert'); 82 Path certificateDatabase = scriptDir.append('pkcert');
83 SecureSocket.initialize(database: certificateDatabase.toNativePath(), 83 SecureSocket.initialize(database: certificateDatabase.toNativePath(),
84 password: 'dartdart'); 84 password: 'dartdart');
85 85
86 startEchoServer() 86 startEchoServer()
87 .then(testClient) 87 .then(testClient)
88 .then((server) { 88 .then((server) {
89 server.close(); 89 server.close();
90 }); 90 });
91 } 91 }
OLDNEW
« no previous file with comments | « tests/standalone/io/https_client_certificate_test.dart ('k') | tests/standalone/io/secure_client_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698