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

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

Issue 23189002: dart:io | Add test for HttpClient requests that never complete their future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add suppressions and issue number in standalone.status. Created 7 years, 4 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Client for secure_bad_certificate_test, that runs in a subprocess.
6 // The test verifies that the client bad certificate callback works.
7
8 import "dart:async";
9 import "dart:io";
10
11 class ExpectException implements Exception {
12 ExpectException(this.message);
13 String toString() => "ExpectException: $message";
14 String message;
15 }
16
17 void expect(condition) {
18 if (!condition) {
19 throw new ExpectException('');
20 }
21 }
22
23 const HOST_NAME = "localhost";
24
25 Future runClients(int port) {
26 var testFutures = [];
27 for (int i = 0; i < 20; ++i) {
28 testFutures.add(
29 SecureSocket.connect(HOST_NAME, port)
30 .then((SecureSocket socket) {
31 expect(false);
32 }, onError: (e) {
33 expect(e is HandshakeException || e is SocketException);
34 }));
35 }
36 return Future.wait(testFutures);
37 }
38
39
40 void main() {
41 final args = new Options().arguments;
42 SecureSocket.initialize();
43 runClients(int.parse(args[0]))
44 .then((_) => print('SUCCESS'));
45 }
OLDNEW
« no previous file with comments | « tests/standalone/io/https_unauthorized_test.dart ('k') | tests/standalone/io/secure_unauthorized_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698