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

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

Issue 20316002: dart:io | Fix handling of exceptions from onBadCertificate callback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: try again Created 7 years, 5 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 | « sdk/lib/io/secure_socket.dart ('k') | tests/standalone/io/secure_bad_certificate_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 // 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 "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 void testSimpleConnectFail(String certificate, bool cancelOnError) { 82 void testSimpleConnectFail(String certificate, bool cancelOnError) {
83 ReceivePort port = new ReceivePort(); 83 ReceivePort port = new ReceivePort();
84 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { 84 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
85 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) 85 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port)
86 .then((clientEnd) { 86 .then((clientEnd) {
87 Expect.fail("No client connection expected."); 87 Expect.fail("No client connection expected.");
88 }) 88 })
89 .catchError((error) { 89 .catchError((error) {
90 Expect.isTrue(error is HandshakeException); 90 Expect.isTrue(error is SocketException ||
91 error is HandshakeException);
91 }); 92 });
92 server.listen((serverEnd) { 93 server.listen((serverEnd) {
93 Expect.fail("No server connection expected."); 94 Expect.fail("No server connection expected.");
94 }, 95 },
95 onError: (error) { 96 onError: (error) {
96 Expect.isTrue(error is CertificateException); 97 Expect.isTrue(error is CertificateException);
97 clientEndFuture.then((_) { 98 clientEndFuture.then((_) {
98 if (!cancelOnError) server.close(); 99 if (!cancelOnError) server.close();
99 port.close(); 100 port.close();
100 }); 101 });
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 connectSecure: true, 519 connectSecure: true,
519 handshakeBeforeSecure: false, 520 handshakeBeforeSecure: false,
520 postponeSecure: false, 521 postponeSecure: false,
521 dropReads: true); 522 dropReads: true);
522 testSimpleReadWrite(listenSecure: false, 523 testSimpleReadWrite(listenSecure: false,
523 connectSecure: false, 524 connectSecure: false,
524 handshakeBeforeSecure: true, 525 handshakeBeforeSecure: true,
525 postponeSecure: true, 526 postponeSecure: true,
526 dropReads: true); 527 dropReads: true);
527 } 528 }
OLDNEW
« no previous file with comments | « sdk/lib/io/secure_socket.dart ('k') | tests/standalone/io/secure_bad_certificate_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698