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

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

Issue 2950413002: Added timeout parameter to RawSecureSocket and SecureSocket connect methods. Also updated CHANGELOG… (Closed)
Patch Set: Created 3 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
« no previous file with comments | « sdk/lib/io/secure_socket.dart ('k') | no next file » | 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 // OtherResources=certificates/server_chain.pem 9 // OtherResources=certificates/server_chain.pem
10 // OtherResources=certificates/server_key.pem 10 // OtherResources=certificates/server_key.pem
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 String msg = "Unexpected error $e"; 73 String msg = "Unexpected error $e";
74 if (trace != null) msg += "\nStackTrace: $trace"; 74 if (trace != null) msg += "\nStackTrace: $trace";
75 Expect.fail(msg); 75 Expect.fail(msg);
76 completer.complete(null); 76 completer.complete(null);
77 }); 77 });
78 }); 78 });
79 }); 79 });
80 return completer.future; 80 return completer.future;
81 } 81 }
82 82
83 void testConnectTimeout() {
84 asyncStart();
85 Duration timeout = new Duration(milliseconds: 20);
86 SecureSocket.connect("8.8.8.7", 80, timeout: timeout).then((socket) {
87 Expect.fail("Unexpected connection made.");
88 asyncEnd();
89 }).catchError((e) {
90 Expect.isTrue(e is SocketException);
91 asyncEnd();
92 });
93 }
94
83 main() async { 95 main() async {
84 asyncStart(); 96 asyncStart();
85 await test('pem', 'dartdart'); 97 await test('pem', 'dartdart');
86 await test('p12', 'dartdart'); 98 await test('p12', 'dartdart');
99 testConnectTimeout();
87 asyncEnd(); 100 asyncEnd();
88 } 101 }
OLDNEW
« no previous file with comments | « sdk/lib/io/secure_socket.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698