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

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

Issue 1665433002: Adds SecurityContext.setTrustedCertificatesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 // 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 "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:async_helper/async_helper.dart"; 13 import "package:async_helper/async_helper.dart";
14 import "package:expect/expect.dart"; 14 import "package:expect/expect.dart";
15 15
16 InternetAddress HOST; 16 InternetAddress HOST;
17 17
18 String localFile(path) => Platform.script.resolve(path).toFilePath(); 18 String localFile(path) => Platform.script.resolve(path).toFilePath();
19 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
20 19
21 SecurityContext serverContext = new SecurityContext() 20 SecurityContext serverContext = new SecurityContext()
22 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 21 ..useCertificateChainSync(localFile('certificates/server_chain.pem'))
23 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 22 ..usePrivateKeySync(localFile('certificates/server_key.pem'),
24 password: 'dartdart'); 23 password: 'dartdart');
25 24
26 SecurityContext clientContext = new SecurityContext() 25 SecurityContext clientContext = new SecurityContext()
27 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 26 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem'));
28 27
29 void testSimpleBind() { 28 void testSimpleBind() {
30 asyncStart(); 29 asyncStart();
31 SecureServerSocket.bind(HOST, 0, serverContext).then((s) { 30 SecureServerSocket.bind(HOST, 0, serverContext).then((s) {
32 Expect.isTrue(s.port > 0); 31 Expect.isTrue(s.port > 0);
33 s.close(); 32 s.close();
34 asyncEnd(); 33 asyncEnd();
35 }); 34 });
36 } 35 }
37 36
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 for (bool cancelOnError in [true, false]) { 232 for (bool cancelOnError in [true, false]) {
234 if (server == null || client == null) { 233 if (server == null || client == null) {
235 testSimpleConnectFail(server, client, cancelOnError); 234 testSimpleConnectFail(server, client, cancelOnError);
236 } 235 }
237 } 236 }
238 } 237 }
239 } 238 }
240 testServerListenAfterConnect(); 239 testServerListenAfterConnect();
241 testSimpleReadWrite(); 240 testSimpleReadWrite();
242 } 241 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_server_closing_test.dart ('k') | tests/standalone/io/secure_session_resume_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698