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

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

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
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 // This test verifies that failing secure connection attempts always complete 5 // This test verifies that failing secure connection attempts always complete
6 // their returned future. 6 // their returned future.
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "package:path/path.dart"; 9 import "package:path/path.dart";
10 import "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 const HOST_NAME = "localhost"; 13 const HOST_NAME = "localhost";
14 const CERTIFICATE = "localhost_cert"; 14 String localFile(path) => Platform.script.resolve(path).toFilePath();
15
16 SecurityContext serverContext = new SecurityContext()
17 ..useCertificateChain(localFile('certificates/untrusted_server_chain.pem'))
18 ..usePrivateKey(localFile('certificates/untrusted_server_key.pem'),
19 password: 'dartdart');
15 20
16 Future<SecureServerSocket> runServer() { 21 Future<SecureServerSocket> runServer() {
17 SecureSocket.initialize( 22 return SecureServerSocket.bind(HOST_NAME, 0, serverContext)
18 database: Platform.script.resolve('pkcert').toFilePath(),
19 password: 'dartdart');
20
21 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
22 .then((SecureServerSocket server) { 23 .then((SecureServerSocket server) {
23 server.listen((SecureSocket socket) { 24 server.listen((SecureSocket socket) {
24 socket.listen((_) { }, 25 socket.listen((_) { },
25 onDone: () { 26 onDone: () {
26 socket.close(); 27 socket.close();
27 }); 28 });
28 }, onError: (e) => Expect.isTrue(e is HandshakeException)); 29 }, onError: (e) => Expect.isTrue(e is HandshakeException));
29 return server; 30 return server;
30 }); 31 });
31 } 32 }
(...skipping 17 matching lines...) Expand all
49 } 50 }
50 }); 51 });
51 } 52 }
52 53
53 runServer().then((server) { 54 runServer().then((server) {
54 clientProcess(server.port).then((_) { 55 clientProcess(server.port).then((_) {
55 server.close(); 56 server.close();
56 }); 57 });
57 }); 58 });
58 } 59 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_unauthorized_client.dart ('k') | tests/standalone/io/socket_upgrade_to_secure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698