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

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

Issue 17589007: dart:io | Change names for SecureSocket exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move VerifyFields to throw ArgumentErrors 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 void testSimpleConnectFail(String certificate, bool cancelOnError) { 81 void testSimpleConnectFail(String certificate, bool cancelOnError) {
82 ReceivePort port = new ReceivePort(); 82 ReceivePort port = new ReceivePort();
83 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) { 83 RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
84 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port) 84 var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port)
85 .then((clientEnd) { 85 .then((clientEnd) {
86 Expect.fail("No client connection expected."); 86 Expect.fail("No client connection expected.");
87 }) 87 })
88 .catchError((error) { 88 .catchError((error) {
89 Expect.isTrue(error is SocketException); 89 Expect.isTrue(error is HandshakeException);
90 }); 90 });
91 server.listen((serverEnd) { 91 server.listen((serverEnd) {
92 Expect.fail("No server connection expected."); 92 Expect.fail("No server connection expected.");
93 }, 93 },
94 onError: (error) { 94 onError: (error) {
95 Expect.isTrue(error is SocketException); 95 Expect.isTrue(error is CertificateException);
96 clientEndFuture.then((_) { 96 clientEndFuture.then((_) {
97 if (!cancelOnError) server.close(); 97 if (!cancelOnError) server.close();
98 port.close(); 98 port.close();
99 }); 99 });
100 }, 100 },
101 cancelOnError: cancelOnError); 101 cancelOnError: cancelOnError);
102 }); 102 });
103 } 103 }
104 104
105 void testServerListenAfterConnect() { 105 void testServerListenAfterConnect() {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 testSimpleConnectFail("not_a_nickname", true); 449 testSimpleConnectFail("not_a_nickname", true);
450 testSimpleConnectFail("CN=notARealDistinguishedName", true); 450 testSimpleConnectFail("CN=notARealDistinguishedName", true);
451 testServerListenAfterConnect(); 451 testServerListenAfterConnect();
452 testSimpleReadWrite(true, true, false); 452 testSimpleReadWrite(true, true, false);
453 testSimpleReadWrite(true, false, false); 453 testSimpleReadWrite(true, false, false);
454 testSimpleReadWrite(false, true, false); 454 testSimpleReadWrite(false, true, false);
455 testSimpleReadWrite(false, false, false); 455 testSimpleReadWrite(false, false, false);
456 testSimpleReadWrite(false, false, true, true); 456 testSimpleReadWrite(false, false, true, true);
457 testSimpleReadWrite(false, false, true, false); 457 testSimpleReadWrite(false, false, true, false);
458 } 458 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698