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

Side by Side Diff: tests/standalone/io/https_bad_certificate_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
« no previous file with comments | « no previous file | tests/standalone/io/https_unauthorized_client.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 // Client for https_bad_certificate_test, that runs in a subprocess. 5 // Client for https_bad_certificate_test, that runs in a subprocess.
6 // It verifies that the client bad certificate callback works in HttpClient. 6 // It verifies that the client bad certificate callback works in HttpClient.
7 7
8 import "dart:async"; 8 import "dart:async";
9 import "dart:io"; 9 import "dart:io";
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 var testFutures = []; 41 var testFutures = [];
42 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result')) 42 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
43 .then((HttpClientRequest request) { 43 .then((HttpClientRequest request) {
44 expect(false); 44 expect(false);
45 }, onError: (e) { 45 }, onError: (e) {
46 expect(e is HandshakeException || e is SocketException); 46 expect(e is HandshakeException || e is SocketException);
47 })); 47 }));
48 48
49 client.badCertificateCallback = badCertificateCallback; 49 client.badCertificateCallback = badCertificateCallback;
50 testFutures.add( client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result')) 50 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
51 .then((HttpClientRequest request) { 51 .then((HttpClientRequest request) {
52 expect(result == 'true'); 52 expect(result == 'true');
53 request.close().then((result) { }); 53 request.close().then((result) { });
54 }, onError: (e) { 54 }, onError: (e) {
55 if (result == 'false') expect (e is HandshakeException || 55 if (result == 'false') expect (e is HandshakeException ||
56 e is SocketException); 56 e is SocketException);
57 else if (result == 'exception') expect (e is ExpectException || 57 else if (result == 'exception') expect (e is ExpectException ||
58 e is SocketException); 58 e is SocketException);
59 else expect (e is ArgumentError || e is SocketException); 59 else expect (e is ArgumentError || e is SocketException);
60 })); 60 }));
61 61
62 client.badCertificateCallback = null; 62 client.badCertificateCallback = null;
63 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result')) 63 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
64 .then((HttpClientRequest request) { 64 .then((HttpClientRequest request) {
65 expect(false); 65 expect(false);
66 }, onError: (e) { 66 }, onError: (e) {
67 expect(e is HandshakeException || e is SocketException); 67 expect(e is HandshakeException || e is SocketException);
68 })); 68 }));
69 69
70 return Future.wait(testFutures); 70 return Future.wait(testFutures);
71 } 71 }
72 72
73 void main() { 73 void main() {
74 final args = new Options().arguments; 74 final args = new Options().arguments;
75 SecureSocket.initialize(); 75 SecureSocket.initialize();
76 int port = int.parse(args[0]); 76 int port = int.parse(args[0]);
77 runHttpClient(port, args[1]) 77 runHttpClient(port, args[1])
78 .then((_) => print('SUCCESS')); 78 .then((_) => print('SUCCESS'));
79 } 79 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/https_unauthorized_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698