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

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

Issue 24492004: Fix https_bad_certificate_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix braino. Created 7 years, 2 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/standalone.status » ('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 24 matching lines...) Expand all
35 if (result == 'false') return false; 35 if (result == 'false') return false;
36 return result; 36 return result;
37 } 37 }
38 38
39 HttpClient client = new HttpClient(); 39 HttpClient client = new HttpClient();
40 40
41 var testFutures = []; // The three async getUrl calls run simultaneously. 41 var testFutures = []; // The three async getUrl calls run simultaneously.
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(result == 'true'); // The session cache may keep the session. 44 expect(result == 'true'); // The session cache may keep the session.
45 return request.close();
45 }, onError: (e) { 46 }, onError: (e) {
46 expect(e is HandshakeException || e is SocketException); 47 expect(e is HandshakeException || e is SocketException);
47 })); 48 }));
48 49
49 client.badCertificateCallback = badCertificateCallback; 50 client.badCertificateCallback = badCertificateCallback;
50 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result')) 51 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
51 .then((HttpClientRequest request) { 52 .then((HttpClientRequest request) {
52 expect(result == 'true'); 53 expect(result == 'true');
53 request.close().then((result) { }); 54 return request.close();
54 }, onError: (e) { 55 }, onError: (e) {
55 if (result == 'false') expect (e is HandshakeException || 56 if (result == 'false') expect (e is HandshakeException ||
56 e is SocketException); 57 e is SocketException);
57 else if (result == 'exception') expect (e is ExpectException || 58 else if (result == 'exception') expect (e is ExpectException ||
58 e is SocketException); 59 e is SocketException);
59 else expect (e is ArgumentError || e is SocketException); 60 else expect (e is ArgumentError || e is SocketException);
60 })); 61 }));
61 62
62 client.badCertificateCallback = null; 63 client.badCertificateCallback = null;
63 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result')) 64 testFutures.add(client.getUrl(Uri.parse('https://$HOST_NAME:$port/$result'))
64 .then((HttpClientRequest request) { 65 .then((HttpClientRequest request) {
65 expect(result == 'true'); // The session cache may keep the session. 66 expect(result == 'true'); // The session cache may keep the session.
67 return request.close();
66 }, onError: (e) { 68 }, onError: (e) {
67 expect(e is HandshakeException || e is SocketException); 69 expect(e is HandshakeException || e is SocketException);
68 })); 70 }));
69 71
70 return Future.wait(testFutures); 72 return Future.wait(testFutures);
71 } 73 }
72 74
73 void main() { 75 void main() {
74 final args = new Options().arguments; 76 final args = new Options().arguments;
75 SecureSocket.initialize(); 77 SecureSocket.initialize();
76 int port = int.parse(args[0]); 78 int port = int.parse(args[0]);
77 runHttpClient(port, args[1]) 79 runHttpClient(port, args[1])
78 .then((_) => print('SUCCESS')); 80 .then((_) => print('SUCCESS'));
79 } 81 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698